1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-01-20 11:51:24 +01:00

25389: rearrange precedence of ZLS_COLORS alternatives.

This commit is contained in:
Bart Schaefer 2008-08-06 02:21:01 +00:00
parent 21d757f50f
commit 16e75d6978
3 changed files with 24 additions and 18 deletions

View file

@ -2,6 +2,12 @@
* 25392: Test/C03traps.ztst: test for 25367
2008-08-05 Barton E. Schaefer <schaefer@zsh.org>
* 25389: Doc/Zsh/mod_complist.yo, Src/Zle/complist.c: once again
rearrange precedence of ZLS_COLORS alternatives to make complex
coloring of file names possible.
2008-08-04 Peter Stephenson <p.w.stephenson@ntlworld.com>
* Src/init.c: 25385: extend 25367 to fix another bug

View file

@ -103,9 +103,9 @@ The var(name) may also be an equals sign (`tt(=)') followed by a
pattern; the tt(EXTENDED_GLOB) option will be turned on for evaluation
of the pattern. The var(value) given for this pattern will be used for all
matches (not just filenames) whose display string are matched by
the pattern. Definitions for both of these take precedence over the
values defined for file types and the form with the leading asterisk
takes precedence over the form with the leading equal sign.
the pattern. Definitions for the form with the leading equal sign take
precedence over the values defined for file types, which in turn take
precedence over the form with the leading asterisk (file extensions).
The last form also allows different parts of the displayed
strings to be colored differently. For this, the pattern has to use the

View file

@ -878,6 +878,21 @@ putfilecol(char *group, char *n, mode_t m, int special)
Extcol ec;
Patcol pc;
nrefs = MAX_POS - 1;
for (pc = mcolors.pats; pc; pc = pc->next)
if ((!pc->prog || !group || pattry(pc->prog, group)) &&
pattryrefs(pc->pat, n, -1, -1, 0, &nrefs, begpos, endpos)) {
if (pc->cols[1]) {
patcols = pc->cols;
return 1;
}
zlrputs(pc->cols[0]);
return 0;
}
if (special != -1) {
colour = special;
} else if (S_ISDIR(m)) {
@ -920,21 +935,6 @@ putfilecol(char *group, char *n, mode_t m, int special)
return 0;
}
nrefs = MAX_POS - 1;
for (pc = mcolors.pats; pc; pc = pc->next)
if ((!pc->prog || !group || pattry(pc->prog, group)) &&
pattryrefs(pc->pat, n, -1, -1, 0, &nrefs, begpos, endpos)) {
if (pc->cols[1]) {
patcols = pc->cols;
return 1;
}
zlrputs(pc->cols[0]);
return 0;
}
zcputs(group, COL_FI);
return 0;