Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: Re: tag-order problem.
- X-seq: zsh-workers 11678
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: PATCH: Re: tag-order problem.
- Date: Wed, 31 May 2000 08:09:50 +0200 (MET DST)
- In-reply-to: "Bart Schaefer"'s message of Tue, 30 May 2000 17:12:32 +0000
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
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 <TAB>
> }
> } 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@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author