From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8897 invoked from network); 31 May 2000 06:10:05 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 31 May 2000 06:10:05 -0000 Received: (qmail 7854 invoked by alias); 31 May 2000 06:09:53 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11678 Received: (qmail 7847 invoked from network); 31 May 2000 06:09:52 -0000 Date: Wed, 31 May 2000 08:09:50 +0200 (MET DST) Message-Id: <200005310609.IAA21412@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: "Bart Schaefer"'s message of Tue, 30 May 2000 17:12:32 +0000 Subject: PATCH: Re: tag-order problem. Bart Schaefer wrote: > On May 30, 11:22pm, Tanaka Akira wrote: > > ... > > } Z(3):akr@serein% Src/zsh -f > } serein% bindkey -e;autoload -U compinit; compinit -D > } serein% zstyle ':completion:*' tag-order '*:label' > } serein% which > } > } This completes nothing. > > I used the example of completing after `lynx' because _lynx has not been > edited since before this broke, whereas _which was changed recently. > > The problem is with the change to _arguments to use a counter instead of > a shift when going around this nested loop: > > ... > > In the previous implementation, `shift descrs' at the point where I've put > `# lots deleted' would mean that the inner while loop consumed all the > descriptions on the first time around the _tags loop, so they were not > tried again for the second and succeeding tags. Now, all the descriptions > are tried for every tag. I'm not sure if that's what Sven intended, but > it breaks the `all tags not explicitly selected are tried last' behavior > in some way. It definitely is what I intended. But, yes, the problem shows up because now the inner loop is run more than once, leading to the state-name being more than once in $state, which makes the test in the caller fail. The patch below just ensures that we don't add states more than once to $state. Another question is if the test in line 345 should be changed (or if $tried should be set when a `->state' was executed). We'll have to play some more with it, I guess. Bye Sven Index: Completion/Base/_arguments =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Base/_arguments,v retrieving revision 1.26 diff -u -r1.26 _arguments --- Completion/Base/_arguments 2000/05/30 07:49:00 1.26 +++ Completion/Base/_arguments 2000/05/31 06:03:10 @@ -223,15 +223,18 @@ fi if [[ "$action" = -\>* ]]; then - comparguments -W line opt_args - state=( "$state[@]" "${${action[3,-1]##[ ]#}%%[ ]#}" ) - if [[ -n "$usecc" ]]; then - curcontext="${oldcontext%:*}:$subc" - else - context=( "$context[@]" "$subc" ) - fi - compstate[restore]='' - aret=yes + action="${${action[3,-1]##[ ]#}%%[ ]#}" + if (( ! $state[(I)$action] )); then + comparguments -W line opt_args + state=( "$state[@]" "$action" ) + if [[ -n "$usecc" ]]; then + curcontext="${oldcontext%:*}:$subc" + else + context=( "$context[@]" "$subc" ) + fi + compstate[restore]='' + aret=yes + fi else if [[ -z "$local" ]]; then local line -- Sven Wischnowsky wischnow@informatik.hu-berlin.de