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

Re: _bison -vV<TAB> dumps core.



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% bison -vV<TAB>zsh: segmentation fault (core dumped)  Src/zsh -f

Yes. That was the test if there is an argument after the option. Also, 
mixing single-letter options and long ones had a bug (after strings
with only one option). Finally, the matches for single-letter option
(containing the `PREFIX') weren't correctly built in `_arguments'.


Thank you for helping me debugging `computil'. Is it fast enough for
you? And is the speed difference to the shell code noticeable?

Bye
 Sven

diff -u oldsrc/Zle/computil.c Src/Zle/computil.c
--- oldsrc/Zle/computil.c	Thu Oct 14 13:41:56 1999
+++ Src/Zle/computil.c	Fri Oct 15 10:29:43 1999
@@ -854,6 +854,8 @@
 		break;
 	    } else if (!p || !p->active || (line[1] && p->args))
 		return NULL;
+	if (end)
+	    *end = line;
 	return p;
     }
     return NULL;
@@ -982,6 +984,9 @@
 	    ddef = state.def = state.curopt->args;
 	    doff = pe - line;
 	    state.optbeg = state.argbeg = state.inopt = cur;
+	    state.singles = (d->single && (!pe || !*pe) &&
+			     state.curopt->name[1] && !state.curopt->name[2]);
+
 	    PERMALLOC {
 		state.oargs[state.curopt->num] = newlinklist();
 	    } LASTALLOC;
@@ -1010,7 +1015,7 @@
 	    ddef = state.def = state.curopt->args;
 	    doff = pe - line;
 	    state.optbeg = state.argbeg = state.inopt = cur;
-	    state.singles = !*pe;
+	    state.singles = (!pe || !*pe);
 
 	    for (p = line + 1; p <= pe; p++) {
 		if ((tmpopt = d->single[STOUC(*p)])) {
@@ -1189,7 +1194,8 @@
 		setsparam(args[1], ztrdup(arg->descr));
 		setsparam(args[2], ztrdup(arg->action));
 
-		ignore_prefix(ca_laststate.doff);
+		if (ca_laststate.doff > 0)
+		    ignore_prefix(ca_laststate.doff);
 		if (arg->type == CAA_RARGS)
 		    restrict_range(ca_laststate.argbeg - 1,
 				   arrlen(compwords) - 1);
diff -u -r oldcompletion/Base/_arguments Completion/Base/_arguments
--- oldcompletion/Base/_arguments	Fri Oct 15 08:25:17 1999
+++ Completion/Base/_arguments	Fri Oct 15 10:33:34 1999
@@ -247,7 +247,7 @@
 	  compadd "$expl[@]" -QqS= - "${PREFIX}${SUFFIX}"
         else
 	  tmp1=( "$next[@]" "$direct[@]" "$odirect[@]" "$equal[@]" )
-	  tmp2=( "${PREFIX}${(@)^tmp1%%:*}" )
+	  tmp2=( "${PREFIX}${(@M)^${(@)${(@)tmp1%%:*}#[-+]}:#?}" )
 
           _describe -o -c "$cmd" option tmp1 tmp2 -Q -S ''
         fi

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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