* PATCH: Re: tag-order problem
@ 2000-05-11 9:10 Sven Wischnowsky
0 siblings, 0 replies; 2+ messages in thread
From: Sven Wischnowsky @ 2000-05-11 9:10 UTC (permalink / raw)
To: zsh-workers
Tanaka Akira wrote:
> Z(4):akr@serein% Src/zsh -f
> serein% bindkey -e; autoload -U compinit; compinit -D; compdef _tst tst
> serein% zstyle ':completion:*' group-name ''
> serein% zstyle ':completion:*:messages' format %d
> serein% zstyle ':completion:*:descriptions' format %d
> serein% zstyle ':completion:*:*:foo:*' tag-order '*' '*:-case'
> serein% zstyle ':completion:*-case' matcher 'm:{a-z}={A-Z}'
> serein% foo c<TAB>
> file
> config.cache config.h config.log config.sub* configure.in
> config.guess* config.h.in config.status* configure*
> file
> CVS/ Completion/ config.guess* config.log configure*
> ChangeLog Config/ config.h config.status* configure.in
> ChangeLog.3.0 config.cache config.h.in config.sub*
>
> I think it shouldn't completes two file sets at once.
Oops. Right, thinko.
Bye
Sven
Index: Completion/Core/_files
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_files,v
retrieving revision 1.10
diff -u -r1.10 _files
--- Completion/Core/_files 2000/05/10 08:00:05 1.10
+++ Completion/Core/_files 2000/05/11 09:10:14
@@ -73,6 +73,7 @@
_path_files "$expl[@]" -g "$pat" "$opts[@]" && ret=0
fi
done
+ (( ret )) || break
done
done
(( ret )) || return 0
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 2+ messages in thread
* PATCH: Re: tag-order problem.
@ 2000-05-31 6:09 Sven Wischnowsky
0 siblings, 0 replies; 2+ messages in thread
From: Sven Wischnowsky @ 2000-05-31 6:09 UTC (permalink / raw)
To: zsh-workers
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2000-05-31 6:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-11 9:10 PATCH: Re: tag-order problem Sven Wischnowsky
2000-05-31 6:09 Sven Wischnowsky
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).