Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] Don't complete escaped words as aliases
- X-seq: zsh-workers 49585
- From: Oliver Kiddle <opk@xxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Cc: Marlon Richert <marlon.richert@xxxxxxxxx>, Mikael Magnusson <mikachu@xxxxxxxxx>, Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: [PATCH] Don't complete escaped words as aliases
- Date: Sun, 14 Nov 2021 14:02:34 +0100
- Archived-at: <https://zsh.org/workers/49585>
- In-reply-to: <CAH+w=7YQvZQJzPqH_gaWVFoN3TsnvFNUFAYJRXYiwuTVVo8QFg@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAHLkEDsK3UH7EkJFDxhsrAeSdmcYpceHsdfu7yPG52-jfjL88A@mail.gmail.com> <CAHYJk3RJRWZJFdbFeT_ujUAi6kTxa3DgHXT7q7UFedfcvMQ1pw@mail.gmail.com> <CAHLkEDtn21jk2WdDAYzMeL=GioSAvXANA1+mCLFSLYSG3nk66w@mail.gmail.com> <CAH+w=7YQvZQJzPqH_gaWVFoN3TsnvFNUFAYJRXYiwuTVVo8QFg@mail.gmail.com>
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