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

Re: Why is an 'x' appended in _prefix completer?

> On 08/03/2023 17:48 Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Wed, Mar 8, 2023 at 4:49 AM Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> >
> > See the comment above addx() in zle_tricky.c and get_comp_string() (i
> > don't actually recommend looking at this code).
> I always wondered why Sven chose to use "x" instead of, say, something
> out-of-band / non-printable.  I guess with metafication etc. maybe
> there wasn't any such thing.
> Anyway, as I recall it, the point of the extra character is to help
> completion distinguish the position of word breaks when completing
> somewhere other than at end of line.

That's a pretty obscure and undocumented effect at the point in question,

      compadd -U -i "$IPREFIX" -I "$ISUFFIX" - "${compstate[unambiguous]%$suf}x"

compadd shouldn't be making this visible to shell code.

This is something to do with inserting an unambiguous prefix; I haven't worked
out on what occasions this line would be hit.  I would guess the _prefix
completer isn't used all that widely?


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