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

Re: menu completion



On Sat, May 23, 2020 at 3:53 AM Pier Paolo Grassi <pierpaolog@xxxxxxxxx> wrote:
>
> Basically I wonder if it is up to the completer to choose whether to do
> interactive menu completion, any thoughts on this?

That's not precisely what's happening.

The completer is deciding that you should see the message "pattern"
because the guard says there are no valid options beginning with a
single hyphen.  (Literally it means anything not beginning with two
hypens must be a pattern, and it doesn't know how to complete
patterns, but the effect is the same.)  It's the setup to display that
message that turns off the menu, because you can't both have a menu
and see the message.

But the guard is wrong -- there actually ARE some options
(non-patterns) that begin with a single hyphen.  So the completer
proceeds to add all the possible matching options, and when control
returns to the top level (_main_complete), it sees the set of
completions is not empty and therefore offers those instead of the
message.

It's possible this should be considered a problem with _message --
that is, that once _message has been called, completion should STOP
and force the message to be seen, instead of continuing to try other
possible variations.  Then instead of

zsh: do you wish to see all 156 possibilities (41 lines)?

you would see (assuming you defined the "format" zstyle) e.g.

completing pattern

(and perhaps get a beep) which is actually what was intended by the guard.

However, I suspect stopping after every _message might break other
valid use cases.



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