From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3460 invoked from network); 5 May 2000 07:36:20 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 5 May 2000 07:36:20 -0000 Received: (qmail 27535 invoked by alias); 5 May 2000 07:36:13 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11172 Received: (qmail 27520 invoked from network); 5 May 2000 07:36:12 -0000 Date: Fri, 5 May 2000 09:36:10 +0200 (MET DST) Message-Id: <200005050736.JAA22599@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Tanaka Akira's message of 05 May 2000 02:54:37 +0900 Subject: PATCH: Re: completion with multiple arguments for an option. Tanaka Akira wrote: > Z(4):akr@serein% Src/zsh -f > serein% bindkey -e; autoload -U compinit; compinit -D > serein% _tst () { _arguments '-o:1:(a):2:(b)' } > serein% compdef _tst tst > serein% tst -o > a b > > It shouldn't complete `b'. Yep. The patch looks bigger than it is. Bye Sven Index: Src/Zle/computil.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/computil.c,v retrieving revision 1.12 diff -u -r1.12 computil.c --- Src/Zle/computil.c 2000/05/03 14:44:01 1.12 +++ Src/Zle/computil.c 2000/05/05 07:35:20 @@ -1438,21 +1438,27 @@ if (single) break; - if (!opt && arg->num >= 0 && !arg->next && miss) - arg = ca_laststate.d->rest; - else { - onum = arg->num; - rest = (onum != arg->min && onum == ca_laststate.nth); - if ((arg = arg->next)) { - if (arg->num != onum + 1) - miss = 1; - } else if (rest || (oopt > 0 && !opt)) { + if (!opt) { + if (arg->num >= 0 && !arg->next && miss) arg = ca_laststate.d->rest; - oopt = -1; + else { + onum = arg->num; + rest = (onum != arg->min && onum == ca_laststate.nth); + if ((arg = arg->next)) { + if (arg->num != onum + 1) + miss = 1; + } else if (rest || (oopt > 0 && !opt)) { + arg = ca_laststate.d->rest; + oopt = -1; + } } + } else { + if (!lopt) + break; + arg = arg->next; } } - if (!single && opt && lopt) { + if (!single && opt && (lopt || ca_laststate.oopt)) { opt = NULL; arg = ca_get_arg(ca_laststate.d, ca_laststate.nth); -- Sven Wischnowsky wischnow@informatik.hu-berlin.de