Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: _archie



Tanaka Akira wrote:

> Z(2):akr@is27e1u11% Src/zsh -f
> is27e1u11% bindkey -e; fpath=($PWD/Completion/*(/)); autoload -U compinit; compinit -D; compdef _tst tst
> is27e1u11% compconf group_matches=yes message_format='%d' description_format='%d'
> is27e1u11% compconf describe_options=yes describe_values=yes option_prefix=yes
> 
> (1) archie -N<TAB>
> flex -C<TAB> has same problem.
> (2) bison -b <TAB>
> (3) bison -vV<TAB>
> (4) cvs -<TAB>

Aargh! Sorry.

Bye
 Sven

diff -u oldsrc/Zle/computil.c Src/Zle/computil.c
--- oldsrc/Zle/computil.c	Thu Oct 21 10:33:09 1999
+++ Src/Zle/computil.c	Thu Oct 21 12:28:22 1999
@@ -863,8 +863,6 @@
 	    } else if (!p || !p->active || (line[1] && p->args) ||
 		       p->name[0] != pre)
 		return NULL;
-	    else
-		p = NULL;
 	if (p && end)
 	    *end = line;
 	return p;
@@ -973,7 +971,7 @@
 		    addlinknode(state.oargs[state.curopt->num], ztrdup(line));
 		} LASTALLOC;
 	    }
-	    state.opt = (state.def->type == CAA_OPT && line[0] && line[1]);
+	    state.opt = (state.def->type == CAA_OPT);
 
 	    if (state.def->type == CAA_REST || state.def->type == CAA_RARGS ||
 		state.def->type == CAA_RREST) {
@@ -984,13 +982,17 @@
 		}
 	    } else if ((state.def = state.def->next))
 		state.argbeg = cur;
-	    else
+	    else {
 		state.curopt = NULL;
+		state.opt = 1;
+	    }
 	} else {
-	    state.opt = (line[0] ? (line[1] ? 2 : 1) : 0);
-	    state.arg = 1;
+	    state.opt = state.arg = 1;
 	    state.curopt = NULL;
 	}
+	if (state.opt)
+	    state.opt = (line[0] ? (line[1] ? 2 : 1) : 0);
+
 	pe = NULL;
 
 	if (state.opt == 2 && (state.curopt = ca_get_opt(d, line, 0, &pe))) {
@@ -1018,7 +1020,9 @@
 		    addlinknode(state.oargs[state.curopt->num], ztrdup(pe));
 		} LASTALLOC;
 	    }
-	    if (!state.def)
+	    if (state.def)
+		state.opt = 0;
+	    else
 		state.curopt = NULL;
 	} else if (state.opt == 2 && d->single &&
 		   (state.curopt = ca_get_sopt(d, line, 0, &pe))) {
@@ -1051,7 +1055,9 @@
 		    addlinknode(state.oargs[state.curopt->num], ztrdup(pe));
 		} LASTALLOC;
 	    }
-	    if (!state.def)
+	    if (state.def)
+		state.opt = 0;
+	    else
 		state.curopt = NULL;
 	} else if (state.arg) {
 	    if (state.inopt) {
@@ -1062,7 +1068,7 @@
 		(state.def->type == CAA_RREST ||
 		 state.def->type == CAA_RARGS)) {
 		state.inrest = 0;
-		state.opt = 0;
+		state.opt = (cur == state.nargbeg + 1);
 		state.optbeg = state.nargbeg;
 		state.argbeg = cur - 1;
 
@@ -1111,9 +1117,10 @@
 	    ca_laststate.ddef = NULL;
 	    ca_laststate.doff = 0;
 	} else if (cur == compcurrent && !ca_laststate.def) {
-	    if ((ca_laststate.def = ddef))
+	    if ((ca_laststate.def = ddef)) {
 		ca_laststate.doff = doff;
-	    else {
+		ca_laststate.opt = 0;
+	    } else {
 		ca_laststate.def = adef;
 		ca_laststate.ddef = NULL;
 		ca_laststate.optbeg = state.nargbeg;

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author