Re: PATCH: new utility function for mixing in extra values
Oliver Kiddle <[email protected]> Sat, 20 Jun 2026 01:44:15 +0200
| Newsgroups | gmane.comp.shells.zsh.devel |
|---|---|
| Message-ID | <[email protected]_l> |
On 16 Jun, dana wrote: > two specific issues with menu select when there are only phony matches: > > - if you e.g. do `shutdown <TAB>` and then back-space, it doesn't > dismiss the menu as it should, the description and phony match remain > on the screen like they do with non-menu-select I've not been able to reproduce this. How are you even getting menu selection with only a single menu option? The one unusual thing that _phony does is set compstate[insert]='' if it added phony matches but no real matches were added and the command-line is empty. For me, this means that, shutdown <tab> will print the description and a match list (consisting of just "now"). A second <tab> is needed to insert the match, or you need to enter at least "n" before pressing <tab>. > - the behaviour where the phony match isn't inserted for an empty word > doesn't really work with menu select imo -- it's fine if it doesn't > immediately insert it but it's incredibly confusing that there's an > apparent item in the list that can't be selected *at all* With your setup, what does $compstate[insert] contain before it is emptied? Perhaps a further condition can be added to detect a setup similar to yours and act differently. > for example, with `_phony none _files` (like `ssh -F`), having 'none' > unceremoniously mixed into the list of files is weird. i don't think i'd > even notice it most of the time, tbh, and if i did it would mislead me > into believing that such a file actually exists It can depend on the context and very often it is better to use _alternative as you suggest. But often that seems like a lot of effort and people writing completions have simply not bothered. As an interface, the wrapper makes them very easy to add. _phony could do the equivalent of _alternative. The existing separate-sections style seems applicable and $_comp_tags could be used to supply a tag when looking it up. But we only have one description provided in the interface, and often that same description is equally applicable to both real and phony matches. My preference is to find a way to apply special formatting to the phony matches. So something like the list-colors style. I'm open to ideas on how that might be best be configured. Oliver