From a057b093680b2430ddb440e319435d67a1b9f7f9 Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Mon, 13 Sep 1999 09:46:39 +0000 Subject: zsh-workers/7791 --- Src/Zle/zle_tricky.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'Src') 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) { -- cgit 1.4.1