From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28855 invoked from network); 17 Apr 2001 09:50:45 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 17 Apr 2001 09:50:45 -0000 Received: (qmail 857 invoked by alias); 17 Apr 2001 09:50:40 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 13999 Received: (qmail 843 invoked from network); 17 Apr 2001 09:50:39 -0000 From: Sven Wischnowsky Date: Tue, 17 Apr 2001 11:50:37 +0200 (MET DST) Message-Id: <200104170950.LAA05595@beta.informatik.hu-berlin.de> To: zsh-workers@sunsite.dk Subject: Re: problem with _arguments exclusion lists In-Reply-To: <20010412143228.99162.qmail@web9307.mail.yahoo.com> Oliver Kiddle wrote: > The following doesn't work too well: > _arguments -s '(-conf)-c' '-conf' '-f' > when you try to complete directly after `-c'. It should still allow the > -conf option because the c could be the c from conf and not the -c > option. This means that completing the -conf option isn't possible. Hrmpf. Yes. This was a bit more complicated to fix because the option should still keep itself from being offered as a possible completion a second time unless it may be given more than once. Bye Sven Index: Src/Zle/computil.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/computil.c,v retrieving revision 1.47 diff -u -r1.47 computil.c --- Src/Zle/computil.c 2001/04/02 09:05:50 1.47 +++ Src/Zle/computil.c 2001/04/17 09:49:17 @@ -1145,7 +1145,7 @@ static LinkList ca_xor; static int -ca_inactive(Cadef d, char **xor, int cur, int opts) +ca_inactive(Cadef d, char **xor, int cur, int opts, char *optname) { if ((xor || opts) && cur <= compcurrent) { Caopt opt; @@ -1153,6 +1153,8 @@ int sl = (d->set ? strlen(d->set) : -1), set = 0; for (; (x = (opts ? "-" : *xor)); xor++) { + if (optname && strcmp(optname, x)) + continue; if (ca_xor) addlinknode(ca_xor, x); set = 0; @@ -1315,9 +1317,9 @@ dopt = NULL; doff = state.singles = arglast = 0; - if (ca_inactive(d, argxor, cur, 0) || + if (ca_inactive(d, argxor, cur, 0, NULL) || ((d->flags & CDF_SEP) && cur != compcurrent && !strcmp(line, "--"))) { - if (ca_inactive(d, NULL, cur, 1)) + if (ca_inactive(d, NULL, cur, 1, NULL)) return 1; continue; } @@ -1391,7 +1393,7 @@ if (!state.oargs[state.curopt->num]) state.oargs[state.curopt->num] = znewlinklist(); - if (ca_inactive(d, state.curopt->xor, cur, 0)) + if (ca_inactive(d, state.curopt->xor, cur, 0, state.curopt->name)) return 1; /* Collect the argument strings. Maybe. */ @@ -1444,7 +1446,7 @@ if (!state.oargs[tmpopt->num]) state.oargs[tmpopt->num] = znewlinklist(); - if (ca_inactive(d, tmpopt->xor, cur, 0)) + if (ca_inactive(d, tmpopt->xor, cur, 0, tmpopt->name)) return 1; } } @@ -1476,7 +1478,7 @@ return 1; else if (state.arg && (!napat || !pattry(napat, line))) { /* Otherwise it's a normal argument. */ - if (napat && ca_inactive(d, NULL, cur + 1, 1)) + if (napat && ca_inactive(d, NULL, cur + 1, 1, NULL)) return 1; arglast = 1; @@ -1791,7 +1793,7 @@ for (node = firstnode(nx); node; incnode(node)) { xor[0] = (char *) getdata(node); if (!strcmp(xor[0], def->sname) || - ca_inactive(def, xor, compcurrent, 0)) + ca_inactive(def, xor, compcurrent, 0, NULL)) break; } if (!node) -- Sven Wischnowsky wischnow@informatik.hu-berlin.de