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

PATCH: bug fix for tricky.c



The completion code numbers patches. This was broken when multiple
groups were used.

Bye
 Sven

diff -u -r os/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- os/Zle/zle_tricky.c	Thu Sep  9 16:32:15 1999
+++ Src/Zle/zle_tricky.c	Sun Sep 12 21:35:38 1999
@@ -7184,11 +7192,8 @@
 	n->mcount = g->mcount;
 	n->matches = p = (Cmatch *) ncalloc((n->mcount + 1) *
 					    sizeof(Cmatch));
-	for (rn = 1, q = g->matches; *q; q++, p++, rn) {
+	for (q = g->matches; *q; q++, p++)
 	    *p = dupmatch(*q);
-	    (*p)->rnum = rn++;
-	    (*p)->gnum = mn++;
-	}
 	*p = NULL;
 
 	n->lcount = g->lcount;
@@ -7219,6 +7224,12 @@
 	    n->ccs = NULL;
 	g = g->next;
     }
+    for (g = amatches; g; g = g->next) {
+	for (rn = 1, q = g->matches; *q; q++) {
+	    (*q)->rnum = rn++;
+	    (*q)->gnum = mn++;
+	}
+    }
     pmatches = amatches;
     hasperm = 1;
     permmnum = mn - 1;
@@ -7289,6 +7300,7 @@
 	g = n;
     }
     hasperm = 0;
+    minfo.cur = NULL;
 }
 
 /* Insert the given string into the command line.  If move is non-zero, *
@@ -7950,7 +7967,7 @@
 	minfo.cur = NULL;
     } else {
 	if (oldlist) {
-	    if (oldins)
+	    if (oldins && minfo.cur)
 		acceptlast();
 	} else
 	    minfo.cur = NULL;
@@ -7967,11 +7984,9 @@
 	}
 	insmnum = comp_mod(insmnum, (minfo.group)->mcount);
     } else {
-	int c = 0;
-
 	insmnum = comp_mod(insmnum, permmnum);
 	for (minfo.group = amatches;
-	     minfo.group && (c += (minfo.group)->mcount) <= insmnum;
+	     minfo.group && (minfo.group)->mcount <= insmnum;
 	     minfo.group = (minfo.group)->next)
 	    insmnum -= (minfo.group)->mcount;
 	if (!minfo.group) {

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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