zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: another _arguments problem
Date: Tue, 8 Feb 2000 14:55:44 +0100 (MET)	[thread overview]
Message-ID: <200002081355.OAA03128@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Tanaka Akira's message of 08 Feb 2000 22:11:53 +0900


Tanaka Akira wrote:

> Z(2):akr@is27e1u11% Src/zsh -f
> is27e1u11% bindkey -e; autoload -U compinit; compinit -D; compdef _tst tst
> is27e1u11% _tst () { _arguments -a ":desc1:(arg1)" "*::desc2:_tst2" }
> is27e1u11% _tst2 () { compadd $CURRENT }
> is27e1u11% tst arg1 -<TAB>
> 
> I think it should insert `a ' but it completes nothing.
> 
> Note that zsh inserts a space in a following case.
> 
> is27e1u11% tst arg1 -a<TAB>

Oops. Somehow I thought I had taken care of that... but that was for a 
slightly different case.

Bye
 Sven

diff -ru ../z.old/Src/Zle/computil.c Src/Zle/computil.c
--- ../z.old/Src/Zle/computil.c	Tue Feb  8 14:12:07 2000
+++ Src/Zle/computil.c	Tue Feb  8 14:52:53 2000
@@ -1006,7 +1006,7 @@
     int nopts;
     Caarg def, ddef;
     Caopt curopt;
-    int opt, arg, argbeg, optbeg, nargbeg, restbeg;
+    int opt, arg, argbeg, optbeg, nargbeg, restbeg, curpos;
     int inopt, inrest, inarg, nth, doff, singles;
     LinkList args;
     LinkList *oargs;
@@ -1055,6 +1055,7 @@
     state.argbeg = state.optbeg = state.nargbeg = state.restbeg =
 	state.nth = state.inopt = state.inarg = state.opt = state.arg = 1;
     state.inrest = state.doff = state.singles = state.doff = 0;
+    state.curpos = compcurrent;
     PERMALLOC {
 	state.args = newlinklist();
 	state.oargs = (LinkList *) zalloc(d->nopts * sizeof(LinkList));
@@ -1409,9 +1410,13 @@
 	}
     case 'O':
 	if ((ca_laststate.opt || (ca_laststate.doff && ca_laststate.def) ||
-	     (ca_laststate.def && ca_laststate.def->type == CAA_OPT)) &&
+	     (ca_laststate.def &&
+	      (ca_laststate.def->type == CAA_OPT ||
+	       ca_laststate.def->type >= CAA_RARGS))) &&
 	    (!ca_laststate.def || ca_laststate.def->type < CAA_RARGS ||
-	     compcurrent == 1)) {
+	     (ca_laststate.def->type == CAA_RARGS ?
+	      (ca_laststate.curpos == ca_laststate.argbeg + 1) :
+	      (compcurrent == 1)))) {
 	    LinkList next = newlinklist();
 	    LinkList direct = newlinklist();
 	    LinkList odirect = newlinklist();

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


             reply	other threads:[~2000-02-08 13:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-02-08 13:55 Sven Wischnowsky [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-02-08 13:11 Tanaka Akira
1999-11-02 13:52 Another " Sven Wischnowsky
1999-11-02 13: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=200002081355.OAA03128@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).