zsh-workers
 help / color / mirror / code / Atom feed
* Re: PATCH: files attributes not colored by complist
@ 1999-10-25  8:30 Sven Wischnowsky
  1999-10-25 10:46 ` Zefram
  1999-10-25 13:50 ` Alexandre Duret-Lutz
  0 siblings, 2 replies; 9+ messages in thread
From: Sven Wischnowsky @ 1999-10-25  8:30 UTC (permalink / raw)
  To: zsh-workers


Alexandre Duret-Lutz wrote:

> This is just a cosmetic patch so that complist 
> does not color files' attributes (as does GNU ls).

I don't use coloured lists, so my opinion shouldn't really count, but
I think that we don't need to exactly copy the GNU-ls behaviour if we
think that we found a place where a slight incompatibility is better.

There already was one incompatibility: if you use a different
background colour for some file type, `complist' uses it in for the
name and the spaces following it so that the right margins of the
columns line up nicely. I *really* prefer it this way -- and your
patch changes it. Just consider something wants to use one set of
back- and foreground colours for all matches so that completion lists
as a whole stand out from the other stuff on the screen. Without your
patch this can easily be done and you get a `block' with a different
background colour. With your patch you get a ugly looking mixture of
the list-background and the normal terminal-background.

Personally I don't like this at all. But maybe we can hear other
opinions?

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: PATCH: files attributes not colored by complist
@ 1999-10-26  7:01 Sven Wischnowsky
  0 siblings, 0 replies; 9+ messages in thread
From: Sven Wischnowsky @ 1999-10-26  7:01 UTC (permalink / raw)
  To: zsh-workers


Alexandre Duret-Lutz wrote:

> I don't want to split hairs, but I think that, while colors should
> stop before file type, the menu-selection mark should still run until
> the end of column.  
> If you agree with this, the following apply after 8412.

Oh... I actually wanted to write it this way and then forgot to add
the tests. Thanks. Sorry.

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: PATCH: files attributes not colored by complist
@ 1999-10-25 12:18 Sven Wischnowsky
  1999-10-25 15:49 ` Alexandre Duret-Lutz
  0 siblings, 1 reply; 9+ messages in thread
From: Sven Wischnowsky @ 1999-10-25 12:18 UTC (permalink / raw)
  To: zsh-workers


Zefram wrote:

> Sven Wischnowsky wrote:
> >Personally I don't like this at all. But maybe we can hear other
> >opinions?
> 
> I don't normally used coloured ls or completion listings at all.  However...
> 
> In the absence of special background colours, I find the GNU ls style,
> with only the filename coloured, to be much more pleasant.  If backgrounds
> are used, I see your point; perhaps we should allow the colours for
> the type characters and spaces to be set separately.  OTOH, the people
> that are setting background colours here are those that have taken the
> time to configure it themselves; they're already using colour ls, and
> so probably do want the GNU behaviour.

This patch adds the `tc' (for type-character) and `sp' (for `space')
capabilities.

> Another thought: we don't need to be compatible, but we shouldn't
> be gratuitously incompatible either.  [Z]LS_COLORS strings should be
> interoperable.

I thought they are. At least we ignore unknown capabilities and I
think I checked that my GNU-ls does that, too.

Bye
 Sven

--- oldsrc/Zle/complist.c	Thu Oct 21 08:59:15 1999
+++ Src/Zle/complist.c	Mon Oct 25 14:12:28 1999
@@ -54,22 +54,24 @@
 #define COL_LC 10
 #define COL_RC 11
 #define COL_EC 12
-#define COL_MA 13
+#define COL_TC 13
+#define COL_SP 14
+#define COL_MA 15
 
-#define NUM_COLS 14
+#define NUM_COLS 16
 
 /* Names of the terminal strings. */
 
 static char *colnames[] = {
     "no", "fi", "di", "ln", "pi", "so", "bd", "cd", "ex", "mi",
-    "lc", "rc", "ec", "ma", NULL
+    "lc", "rc", "ec", "tc", "sp", "ma", NULL
 };
 
 /* Default values. */
 
 static char *defcols[] = {
     "0", "0", "1;34", "1;36", "33", "1;35", "1;33", "1;33", "1;32", NULL,
-    "\033[", "m", NULL, "7"
+    "\033[", "m", NULL, "0", "0", "7"
 };
 
 /* This describes a terminal string for a filename extension. */
@@ -246,6 +248,15 @@
     return;
 }
 
+/* Information about the list shown. */
+
+static int noselect, mselect, inselect, mcol, mline, mcols, mlines, mmlen;
+static Cmatch **mtab, **mmtabp;
+static Cmgroup *mgtab, *mgtabp;
+static struct listcols mcolors;
+
+/* The last color used. */
+
 static int last_col = COL_NO;
 
 static void
@@ -272,6 +283,17 @@
     return;
 }
 
+/* Turn off colouring. */
+
+static void
+zcoff(void)
+{
+    if (mcolors.cols[COL_EC])
+	tputs(mcolors.cols[COL_EC], 1, putshout);
+    else
+	zcputs(&mcolors, COL_NO);
+}
+
 /* Get the terminal color string for the file with the given name and
  * file modes. */
 
@@ -312,14 +334,6 @@
     return;
 }
 
-/* Information about the list shown. */
-
-static int noselect, mselect, inselect, mcol, mline, mcols, mlines, mmlen;
-static Cmatch **mtab, **mmtabp;
-static Cmgroup *mgtab, *mgtabp;
-static struct listcols mcolors;
-
-
 static void
 clprintm(Cmgroup g, Cmatch *mp, int mc, int ml, int lastc, int width,
 	 char *path, struct stat *buf)
@@ -361,10 +375,7 @@
 	    cc = COL_NO;
 	zcputs(&mcolors, cc);
 	printfmt(m->disp, 0, 1, 0);
-	if (mcolors.cols[COL_EC])
-	    tputs(mcolors.cols[COL_EC], 1, putshout);
-	else
-	    zcputs(&mcolors, COL_NO);
+	zcoff();
     } else {
 	int mx;
 
@@ -402,28 +413,26 @@
 	len = niceztrlen(m->disp ? m->disp : m->str);
 
 	if (isset(LISTTYPES)) {
+	    zcoff();
+	    zcputs(&mcolors, COL_TC);
 	    if (buf)
 		putc(file_type(buf->st_mode), shout);
 	    else
 		putc(' ', shout);
 	    len++;
 	}
-	len = width - len - 2;
-
-	while (len-- > 0)
-	    putc(' ', shout);
+	if ((len = width - len - 2) > 0) {
+	    zcoff();
+	    zcputs(&mcolors, COL_SP);
 
-	if (mcolors.cols[COL_EC])
-	    tputs(mcolors.cols[COL_EC], 1, putshout);
-	else
-	    zcputs(&mcolors, COL_NO);
+	    while (len-- > 0)
+		putc(' ', shout);
+	}
+	zcoff();
 	if (!lastc) {
 	    zcputs(&mcolors, COL_NO);
 	    fputs("  ", shout);
-	    if (mcolors.cols[COL_EC])
-		tputs(mcolors.cols[COL_EC], 1, putshout);
-	    else
-		zcputs(&mcolors, COL_NO);
+	    zcoff();
 	}
     }
 }
--- olddoc/Zsh/mod_complist.yo	Thu Oct 21 08:59:20 1999
+++ Doc/Zsh/mod_complist.yo	Mon Oct 25 14:11:26 1999
@@ -61,6 +61,13 @@
 item(tt(rc m))(
 for the right code
 )
+item(tt(tc) var(0))(
+for the character indicating the file type  printed after filenames if
+the tt(LIST_TYPES) option is set
+)
+item(tt(sp) var(0))(
+for the spaces printed after matches to align the next column
+)
 item(tt(ec) var(none))(
 for the end code
 )

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: PATCH: files attributes not colored by complist
@ 1999-10-25 11:56 Sven Wischnowsky
  0 siblings, 0 replies; 9+ messages in thread
From: Sven Wischnowsky @ 1999-10-25 11:56 UTC (permalink / raw)
  To: zsh-workers


Alexandre Duret-Lutz wrote:

> BTW, there is another thing I *do* like in GNU ls, it's its
> multi-column's output with variable width for columns.  This allow to
> put more files on less lines.  Do you think Zsh could do that too ?

The latest interims version has the `listpacked' option which does
exactly that.

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: PATCH: files attributes not colored by complist
@ 1999-10-25  8:33 Sven Wischnowsky
  0 siblings, 0 replies; 9+ messages in thread
From: Sven Wischnowsky @ 1999-10-25  8:33 UTC (permalink / raw)
  To: zsh-workers


I wrote:

> patch changes it. Just consider something wants to use one set of
                                      ^^^^^

That should be `one', of course. Oh my...

> back- and foreground colours for all matches so that completion lists
> as a whole stand out from the other stuff on the screen.


Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 9+ messages in thread
* PATCH: files attributes not colored by complist
@ 1999-10-24 19:32 Alexandre Duret-Lutz
  0 siblings, 0 replies; 9+ messages in thread
From: Alexandre Duret-Lutz @ 1999-10-24 19:32 UTC (permalink / raw)
  To: zsh-workers


This is just a cosmetic patch so that complist 
does not color files' attributes (as does GNU ls).


--- Src/Zle/complist.c.old	Thu Oct 21 13:47:02 1999
+++ Src/Zle/complist.c	Sun Oct 24 20:13:48 1999
@@ -401,6 +401,13 @@
 	nicezputs((m->disp ? m->disp : m->str), shout);
 	len = niceztrlen(m->disp ? m->disp : m->str);
 
+	if (m->gnum != mselect) {
+	    if (mcolors.cols[COL_EC])
+		tputs(mcolors.cols[COL_EC], 1, putshout);
+	    else
+		zcputs(&mcolors, COL_NO);
+	}
+
 	if (isset(LISTTYPES)) {
 	    if (buf)
 		putc(file_type(buf->st_mode), shout);
@@ -413,10 +420,13 @@
 	while (len-- > 0)
 	    putc(' ', shout);
 
-	if (mcolors.cols[COL_EC])
-	    tputs(mcolors.cols[COL_EC], 1, putshout);
-	else
-	    zcputs(&mcolors, COL_NO);
+	if (m->gnum == mselect) {
+	    if (mcolors.cols[COL_EC])
+		tputs(mcolors.cols[COL_EC], 1, putshout);
+	    else
+		zcputs(&mcolors, COL_NO);
+	}
+
 	if (!lastc) {
 	    zcputs(&mcolors, COL_NO);
 	    fputs("  ", shout);


-- 
Alexandre Duret-Lutz


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~1999-10-26  7:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-10-25  8:30 PATCH: files attributes not colored by complist Sven Wischnowsky
1999-10-25 10:46 ` Zefram
1999-10-25 13:50 ` Alexandre Duret-Lutz
  -- strict thread matches above, loose matches on Subject: below --
1999-10-26  7:01 Sven Wischnowsky
1999-10-25 12:18 Sven Wischnowsky
1999-10-25 15:49 ` Alexandre Duret-Lutz
1999-10-25 11:56 Sven Wischnowsky
1999-10-25  8:33 Sven Wischnowsky
1999-10-24 19:32 Alexandre Duret-Lutz

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).