From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22433 invoked from network); 15 Oct 1999 08:38:19 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 15 Oct 1999 08:38:19 -0000 Received: (qmail 20122 invoked by alias); 15 Oct 1999 08:38:01 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 8270 Received: (qmail 20115 invoked from network); 15 Oct 1999 08:38:01 -0000 Date: Fri, 15 Oct 1999 10:37:53 +0200 (MET DST) Message-Id: <199910150837.KAA17572@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Tanaka Akira's message of 15 Oct 1999 17:02:45 +0900 Subject: Re: _bison -vV 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 -vVzsh: 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@informatik.hu-berlin.de