From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29513 invoked from network); 4 Feb 2000 09:59:49 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 4 Feb 2000 09:59:49 -0000 Received: (qmail 876 invoked by alias); 4 Feb 2000 09:59:43 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9560 Received: (qmail 868 invoked from network); 4 Feb 2000 09:59:43 -0000 Date: Fri, 4 Feb 2000 10:59:39 +0100 (MET) Message-Id: <200002040959.KAA23014@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Tanaka Akira's message of 04 Feb 2000 04:14:06 +0900 Subject: Re: _arguments problems Tanaka Akira wrote: > Z:akr@is27e1u11% Src/zsh -f > is27e1u11% bindkey -e; autoload -U compinit; compinit -D; compdef _tst tst > is27e1u11% _tst () { _arguments "1:desc1:(arg1)" } > is27e1u11% tst > > This completes nothing but it should completes `arg1'. It would have worked in argument number 49. Ouch. > is27e1u11% _tst () { _arguments '-a' '*::rest:_tst2' } > is27e1u11% _tst2 () { compadd - '-b' } > is27e1u11% tst arg - > -b > -a > > This completes `-a' and `-b' but it shouldn't completes `-a'. Hm. I see why you think it shouldn't and it can be achieved by applying the first hunk below. *But* if we do that there wouldn't be a way to get at the options in cases like this one (ok, it works with longer options but with short ones like these one would have to type the whole option to complete it). I'm really not sure if this is a good idea, I could only convince myself to build that patch because one can always set the prefix-needed style to false for such commands. I'd like to hear other opinions: does anyone think that this might surprise users? Or maybe I'm worrying too much about to special a case... Bye Sven diff -ru ../z.old/Completion/Base/_arguments Completion/Base/_arguments --- ../z.old/Completion/Base/_arguments Fri Feb 4 09:54:06 2000 +++ Completion/Base/_arguments Fri Feb 4 10:57:05 2000 @@ -260,8 +260,8 @@ if [[ -z "$matched$mesg" ]] && _requested options && { ! zstyle -t ":completion:${curcontext}:options" prefix-needed || - [[ "$origpre" = [-+]* || - ( -z "$aret$mesg" && nm -eq compstate[nmatches] ) ]] } ; then + [[ ( "$origpre" = [-+]* || -z "$aret$mesg" ) && + nm -eq compstate[nmatches] ]] } ; then local prevpre="$PREFIX" previpre="$IPREFIX" PREFIX="$origpre" diff -ru ../z.old/Src/Zle/computil.c Src/Zle/computil.c --- ../z.old/Src/Zle/computil.c Fri Feb 4 10:35:15 2000 +++ Src/Zle/computil.c Fri Feb 4 10:47:46 2000 @@ -821,7 +821,7 @@ int num = 0; while (*p && idigit(*p)) - num = (num * 10) + ((int) *p++); + num = (num * 10) + (((int) *p++) - '0'); anum = num + 1; } else -- Sven Wischnowsky wischnow@informatik.hu-berlin.de