zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.dk
Subject: Re: problem with _arguments exclusion lists
Date: Tue, 17 Apr 2001 11:50:37 +0200 (MET DST)	[thread overview]
Message-ID: <200104170950.LAA05595@beta.informatik.hu-berlin.de> (raw)
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


  reply	other threads:[~2001-04-17  9:50 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-12 14:32 Oliver Kiddle
2001-04-17  9:50 ` Sven Wischnowsky [this message]
2001-04-17 10:44   ` Oliver Kiddle
2001-04-17 11:28     ` Sven Wischnowsky
2001-04-17 13:55       ` Oliver Kiddle
2001-04-17 14:10         ` Sven Wischnowsky
2001-04-19 14:01           ` Oliver Kiddle
2001-04-20  8:31             ` Sven Wischnowsky
2001-04-23  8:59               ` Oliver Kiddle
2001-04-24 10:00                 ` Sven Wischnowsky
2001-04-26 11:00                   ` Oliver Kiddle
2001-04-26 12:10                     ` Sven Wischnowsky
2001-04-25  7:10                 ` Sven Wischnowsky
2001-04-26 13:55 Oliver Kiddle
2001-04-26 14:35 ` Sven Wischnowsky
2001-05-04 16:20   ` Oliver Kiddle
2001-05-07 11:10     ` Sven Wischnowsky
2001-05-08 11:45       ` Oliver Kiddle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200104170950.LAA05595@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).