zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: bug fix for tricky.c
@ 1999-09-13  9:03 Sven Wischnowsky
  0 siblings, 0 replies; only message in thread
From: Sven Wischnowsky @ 1999-09-13  9:03 UTC (permalink / raw)
  To: zsh-workers


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@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1999-09-13  9:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-09-13  9:03 PATCH: bug fix for tricky.c Sven Wischnowsky

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).