Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug: Completion of the 'zsh' command.

On Oct 9,  8:01pm, Bart Schaefer wrote:
} Furthermore, I don't remember what '*:' does for _arguments

Figured out that it's shorthand for '*:::' which causes _arguments to
go though this branch (some whitespace removed for compactness):

    if [[ "$action" = \ # ]]; then
      # An empty action means that we should just display a message.
      _message -e "$subc" "$descr"

} there is first a call to _arguments which has the unintended (?) side-
} effect of erasing compstate[insert].

That's coming from "_message -e ..." which has:

  (( $compstate[nmatches] )) || compstate[insert]=

The problem of course is that we haven't finished generating all the
matches yet, so it's premature to test (( $compstate[nmatches] )).

Several possible approaches come to mind:

(1) The patch I already sent, which assures that this call to _message
happens late enough for $compstate[nmatches] to be valid.

(2) Instead of '*:' aka '*:::' as the last argument of _arguments in _sh,
actually give it an action, '*:::_default' (or something more clever).
This bypasses the call to _message -e, but makes it appear that every
zsh option (except -c) takes an argument, which (I think) changes the
zstyle context ... which probably hardly ever matters, but ...

(3) Fiddle with _message somehow, for example, shove the assignment to
compstate[insert] into a comppostfuncs callback -- except then I'm not
sure it happens soon enough, so we've exchanged one problem for another.

Anybody have an opinion?

Messages sorted by: Reverse Date, Date, Thread, Author