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

Re: Bug in completion with curly braces?



On Sun, Nov 22, 2020 at 10:46 PM Felipe Contreras
<felipe.contreras@xxxxxxxxx> wrote:
>
> Yeah, this almost works, but I'm not interested in hacks.
[...]
> I'm not going to add dozens of lines of code just for this corner-case
> depending on the value of $1. If compadd doesn't work on this case,
> then it doesn't work on this case.

There could easily be more documentation around "compadd -Q", because
really it is itself a hack.

The parts of completion that analyze/dismantle the string on the
command line, before _main_complete or another entry point are even
called, are always going to process the line as if special characters
that are not quoted do in fact have their special meanings.  The real
purpose of -Q is not to disable quoting, it's to indicate that the
calling function has already applied the appropriate quoting and
therefore compadd should not also attempt it.

Consequently if the calling function does not apply quoting, -Q is
only going to work well in cases where the matches either have no
common prefixes, or the common prefixes do not contain any of the
special characters, or menu completion is going to be forced (so the
user selects an entire match all at once rather than exit/re-enter
completion with the prefix).

(I would be happy to have someone (Oliver?) argue the untruth of that
last statement.)




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