Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: completion: highlight matching part



On Aug 4,  4:54pm, Bart Schaefer wrote:
} Subject: Re: completion: highlight matching part
}
} On Aug 4,  8:44pm, Peter Stephenson wrote:
} } Subject: Re: completion: highlight matching part
} }
} } On Sun, 03 Aug 2008 17:33:21 -0700
} } Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
} } > (1) Change complist.c:putfilecol() so that pattern tests come first,
} } >     then mode tests, and finally extension tests.
} } 
} } I should think this is the right thing to do, isn't it?
} 
} I agree

Here's the patch, mostly so you can proof my doc change.

Index: Doc/Zsh/mod_complist.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/mod_complist.yo,v
retrieving revision 1.24
diff -u -r1.24 mod_complist.yo
--- Doc/Zsh/mod_complist.yo	5 Jul 2008 19:55:29 -0000	1.24
+++ Doc/Zsh/mod_complist.yo	5 Aug 2008 00:15:00 -0000
@@ -103,9 +103,9 @@
 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
Index: Src/Zle/complist.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/complist.c,v
retrieving revision 1.117
diff -u -r1.117 complist.c
--- Src/Zle/complist.c	5 Jul 2008 19:55:29 -0000	1.117
+++ Src/Zle/complist.c	5 Aug 2008 00:15:00 -0000
@@ -878,6 +878,21 @@
     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 @@
 	    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;



Messages sorted by: Reverse Date, Date, Thread, Author