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

Re: playing with backreferences in list-colors



Alexandre Duret-Lutz wrote:

> ...
> 
> Does string="./aafoo" in frame #1 means that `(#b)(a)#*' is matched
> over "./aafoo" instead of only "aafoo"?

Yes, it was indeed using the path, which was wrong in this case.

The rest of the patch makes the complist module be loaded if the
list-colors style is used and it isn't already loaded and it makes the 
reported position of -1 be used correctly.

Bye
 Sven

diff -ru ../z.old/Completion/Core/_setup Completion/Core/_setup
--- ../z.old/Completion/Core/_setup	Mon Jan 24 09:58:02 2000
+++ Completion/Core/_setup	Mon Jan 24 10:35:30 2000
@@ -3,6 +3,7 @@
 local val nm="$compstate[nmatches]"
 
 if zstyle -a ":completion${curcontext}:$1" list-colors val; then
+  zmodload -e zsh/complist || zmodload -i zsh/complist
   if [[ "$1" = default ]]; then
     ZLS_COLORS="${(j.:.)${(@)val:gs/:/\\\:}}"
   else
diff -ru ../z.old/Src/Zle/complist.c Src/Zle/complist.c
--- ../z.old/Src/Zle/complist.c	Mon Jan 24 09:57:32 2000
+++ Src/Zle/complist.c	Mon Jan 24 10:44:16 2000
@@ -453,13 +453,13 @@
     curisbeg = curisend = 0;
 
     for (i = nrefs;  i < MAX_POS; i++)
-	begpos[i] = -1, endpos[i] = 0xfffffff;
+	begpos[i] = endpos[i] = -1;
 }
 
 static void
 doiscol(Listcols c, int pos)
 {
-    if (pos > endpos[curisend]) {
+    if (endpos[curisend] >= 0 && pos > endpos[curisend]) {
 	curisend++;
 	if (curiscol) {
 	    zcputs(c, NULL, COL_NO);
@@ -700,7 +700,7 @@
 	else if (mselect >= 0 && (m->flags & (CMF_MULT | CMF_FMULT)))
 	    zcputs(&mcolors, g->name, COL_DU);
 	else if (buf)
-	    subcols = putfilecol(&mcolors, g->name, path, buf->st_mode);
+	    subcols = putfilecol(&mcolors, g->name, m->str, buf->st_mode);
 	else
 	    subcols = putmatchcol(&mcolors, g->name, (m->disp ? m->disp : m->str));
 

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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