Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: problem with _arguments exclusion lists
- X-seq: zsh-workers 13999
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: problem with _arguments exclusion lists
- Date: Tue, 17 Apr 2001 11:50:37 +0200 (MET DST)
- In-reply-to: <20010412143228.99162.qmail@xxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
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@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author