summary refs log tree commit diff
path: root/Src/Zle
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2000-06-19 13:09:06 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2000-06-19 13:09:06 +0000
commitc071087d1f9850d2c6e9c690797d833c6cb6268f (patch)
treec1e4af6d82b642ecaa074b7c6497836f74a91ddf /Src/Zle
parent030130366618816fdf35ac4d18d85fe8d959dd98 (diff)
downloadzsh-c071087d1f9850d2c6e9c690797d833c6cb6268f.tar.gz
zsh-c071087d1f9850d2c6e9c690797d833c6cb6268f.tar.xz
zsh-c071087d1f9850d2c6e9c690797d833c6cb6268f.zip
_arguments: small fix for -s and new `!...' for things not to complete (but to understand) (11985)
Diffstat (limited to 'Src/Zle')
-rw-r--r--Src/Zle/computil.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index d65eaa5bf..da72a6902 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -325,6 +325,7 @@ struct caopt {
     int active;			/* still allowed on command line */
     int num;			/* it's the num'th option */
     char *set;			/* set name, shared */
+    int not;			/* don't complete this option (`!...') */
 };
 
 #define CAO_NEXT    1
@@ -573,7 +574,7 @@ parse_cadef(char *nam, char **args)
     char *adpre, *adsuf, *axor = NULL, *doset = NULL, **setp = NULL;
     char *nonarg = NULL;
     int single = 0, anum = 1, xnum, nopts, ndopts, nodopts, flags = 0;
-    int state = 0;
+    int state = 0, not = 0;
 
     nopts = ndopts = nodopts = 0;
 
@@ -683,6 +684,8 @@ parse_cadef(char *nam, char **args)
 	}
 	p = dupstring(*args);
 	xnum = 0;
+	if ((not = (*p == '!')))
+	    p++;
 	if (*p == '(') {
 	    /* There is a xor list, get it. */
 
@@ -910,6 +913,7 @@ parse_cadef(char *nam, char **args)
 	    opt->type = otype;
 	    opt->args = oargs;
 	    opt->num = nopts++;
+	    opt->not = not;
 
 	    if (otype == CAO_DIRECT || otype == CAO_EQUAL)
 		ndopts++;
@@ -932,6 +936,9 @@ parse_cadef(char *nam, char **args)
 
 	    int type = CAA_REST;
 
+	    if (not)
+		continue;
+
 	    if (*++p != ':') {
 		freecadef(all);
 		zwarnnam(nam, "invalid rest argument definition: %s", *args, 0);
@@ -957,6 +964,9 @@ parse_cadef(char *nam, char **args)
 	    int type = CAA_NORMAL, direct;
 	    Caarg arg, tmp, pre;
 
+	    if (not)
+		continue;
+
 	    if ((direct = idigit(*p))) {
 		/* Argment number is given. */
 		int num = 0;
@@ -1100,7 +1110,7 @@ ca_get_sopt(Cadef d, char *line, char **end, LinkList *lp)
 		}
 		break;
 	    }
-	} else if (p && !p->active)
+	} else if (!p || (p && !p->active))
 	    return NULL;
 	p = NULL;
     }
@@ -1853,7 +1863,7 @@ bin_comparguments(char *nam, char **args, char *ops, int func)
 		      (compcurrent == 1)))) {
 		    ret = 0;
 		    for (p = lstate->d->opts; p; p = p->next) {
-			if (p->active) {
+			if (p->active && !p->not) {
 			    switch (p->type) {
 			    case CAO_NEXT:    l = next;    break;
 			    case CAO_DIRECT:  l = direct;  break;