about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBart Schaefer <barts@users.sourceforge.net>2008-08-06 02:21:01 +0000
committerBart Schaefer <barts@users.sourceforge.net>2008-08-06 02:21:01 +0000
commit16e75d6978157eea40967c3b731091a32ced6339 (patch)
treeb7684a4ebac8c750baae497a386dcac37004f40d
parent21d757f50f67653d06c798367e50288d6a95917e (diff)
downloadzsh-16e75d6978157eea40967c3b731091a32ced6339.tar.gz
zsh-16e75d6978157eea40967c3b731091a32ced6339.tar.xz
zsh-16e75d6978157eea40967c3b731091a32ced6339.zip
25389: rearrange precedence of ZLS_COLORS alternatives.
-rw-r--r--ChangeLog6
-rw-r--r--Doc/Zsh/mod_complist.yo6
-rw-r--r--Src/Zle/complist.c30
3 files changed, 24 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index 6819eb0d2..810d06557 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/Doc/Zsh/mod_complist.yo b/Doc/Zsh/mod_complist.yo
index e5d2b463f..710e0aae4 100644
--- a/Doc/Zsh/mod_complist.yo
+++ b/Doc/Zsh/mod_complist.yo
@@ -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
diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c
index de4b493c7..cd205692c 100644
--- a/Src/Zle/complist.c
+++ b/Src/Zle/complist.c
@@ -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;