From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3954 invoked from network); 13 Sep 1999 09:03:37 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 13 Sep 1999 09:03:37 -0000 Received: (qmail 26942 invoked by alias); 13 Sep 1999 09:03:32 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7791 Received: (qmail 26935 invoked from network); 13 Sep 1999 09:03:32 -0000 Date: Mon, 13 Sep 1999 11:03:30 +0200 (MET DST) Message-Id: <199909130903.LAA05525@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk Subject: 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@informatik.hu-berlin.de