From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: Re: tag-order problem.
Date: Wed, 31 May 2000 08:09:50 +0200 (MET DST) [thread overview]
Message-ID: <200005310609.IAA21412@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: "Bart Schaefer"'s message of Tue, 30 May 2000 17:12:32 +0000
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@informatik.hu-berlin.de
next reply other threads:[~2000-05-31 6:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-05-31 6:09 Sven Wischnowsky [this message]
-- strict thread matches above, loose matches on Subject: below --
2000-05-11 9:10 Sven Wischnowsky
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=200005310609.IAA21412@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).