From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: PATCH: files attributes not colored by complist
Date: Mon, 25 Oct 1999 14:18:07 +0200 (MET DST) [thread overview]
Message-ID: <199910251218.OAA05653@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Zefram's message of Mon, 25 Oct 1999 11:46:50 +0100 (BST)
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
next reply other threads:[~1999-10-25 12:18 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-10-25 12:18 Sven Wischnowsky [this message]
1999-10-25 15:49 ` Alexandre Duret-Lutz
-- strict thread matches above, loose matches on Subject: below --
1999-10-26 7:01 Sven Wischnowsky
1999-10-25 11:56 Sven Wischnowsky
1999-10-25 8:33 Sven Wischnowsky
1999-10-25 8:30 Sven Wischnowsky
1999-10-25 10:46 ` Zefram
1999-10-25 13:50 ` Alexandre Duret-Lutz
1999-10-24 19:32 Alexandre Duret-Lutz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199910251218.OAA05653@beta.informatik.hu-berlin.de \
--to=wischnow@informatik.hu-berlin.de \
--cc=zsh-workers@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).