From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23134 invoked from network); 25 Oct 1999 12:18:23 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 25 Oct 1999 12:18:23 -0000 Received: (qmail 13605 invoked by alias); 25 Oct 1999 12:18:17 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 8412 Received: (qmail 13597 invoked from network); 25 Oct 1999 12:18:17 -0000 Date: Mon, 25 Oct 1999 14:18:07 +0200 (MET DST) Message-Id: <199910251218.OAA05653@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Zefram's message of Mon, 25 Oct 1999 11:46:50 +0100 (BST) Subject: Re: PATCH: files attributes not colored by complist 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