zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: _bison -vV<TAB> dumps core.
Date: Fri, 15 Oct 1999 10:37:53 +0200 (MET DST)	[thread overview]
Message-ID: <199910150837.KAA17572@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Tanaka Akira's message of 15 Oct 1999 17:02:45 +0900


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@informatik.hu-berlin.de


             reply	other threads:[~1999-10-15  8:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-10-15  8:37 Sven Wischnowsky [this message]
1999-10-15 10:14 ` Tanaka Akira
  -- strict thread matches above, loose matches on Subject: below --
1999-10-15 10:29 Sven Wischnowsky
1999-10-15  8:02 Tanaka Akira

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=199910150837.KAA17572@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.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).