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

Re: [PATCH] Don't complete escaped words as aliases



Bart Schaefer wrote:
> On Sat, Nov 13, 2021 at 9:18 AM Marlon Richert <marlon.richert@xxxxxxxxx> wrote:
> >
> > Would this be preferable? I can make that change. No other
> > alternatives come to mind right now.

That approach would also have the effect of adding back in to $PREFIX
characters that were shifted off to $IPREFIX.

Another option might be to filter out just quoted aliases and complete
only them:

  aq=( "${(@Qk)aliases}" )
  print -lr --  "${(@k)aliases:|aq}"

> Hm, it seems as though what's really needed here is for the completion
> internals to compare the full quoted word to the set of matches,
> rather than remove the quoting first.  Skipping the completion because
> the word is quoted is at best a workaround.
>
> I suppose that would need a new option to compadd.  It might help in

Intuitively I would think this should be an additional effect of the
existing -Q option.

> some other edge cases as well -- lots of completion bugs arise from
> the internals attempting to properly remove and restore quoting.

The trouble is that completion fully strips quotes and parses the
command-line into words very early on. There's no getting the original
form back, at least not in a way where you know which character
corresponds to which. It would needed a layer of abstraction such as a
rope data structure when unquoting.

Oliver




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