about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-09-13 09:46:39 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-09-13 09:46:39 +0000
commita057b093680b2430ddb440e319435d67a1b9f7f9 (patch)
treec00bde672e3fb4194c41f66ddfbcd19ba0a28537
parent679b7a7599762d80928fff86b7b7a5e87997074b (diff)
downloadzsh-a057b093680b2430ddb440e319435d67a1b9f7f9.tar.gz
zsh-a057b093680b2430ddb440e319435d67a1b9f7f9.tar.xz
zsh-a057b093680b2430ddb440e319435d67a1b9f7f9.zip
zsh-workers/7791
-rw-r--r--Src/Zle/zle_tricky.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index f3d8677a8..ae42c7b8e 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -7184,11 +7184,8 @@ permmatches(void)
 	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 +7216,12 @@ permmatches(void)
 	    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 +7292,7 @@ freematches(void)
 	g = n;
     }
     hasperm = 0;
+    minfo.cur = NULL;
 }
 
 /* Insert the given string into the command line.  If move is non-zero, *
@@ -7950,7 +7954,7 @@ do_ambig_menu(void)
 	minfo.cur = NULL;
     } else {
 	if (oldlist) {
-	    if (oldins)
+	    if (oldins && minfo.cur)
 		acceptlast();
 	} else
 	    minfo.cur = NULL;
@@ -7967,11 +7971,9 @@ do_ambig_menu(void)
 	}
 	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) {