zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <opk@zsh.org>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Marlon Richert <marlon.richert@gmail.com>,
	Mikael Magnusson <mikachu@gmail.com>,
	Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [PATCH] Don't complete escaped words as aliases
Date: Sun, 14 Nov 2021 14:02:34 +0100	[thread overview]
Message-ID: <75344-1636894954.430445@bbTu.fE6Q.VZqQ> (raw)
In-Reply-To: <CAH+w=7YQvZQJzPqH_gaWVFoN3TsnvFNUFAYJRXYiwuTVVo8QFg@mail.gmail.com>

Bart Schaefer wrote:
> On Sat, Nov 13, 2021 at 9:18 AM Marlon Richert <marlon.richert@gmail.com> 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


      reply	other threads:[~2021-11-14 13:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-12 21:34 Marlon Richert
2021-11-13  7:02 ` Mikael Magnusson
2021-11-13 17:11   ` Marlon Richert
2021-11-13 20:59     ` Bart Schaefer
2021-11-14 13:02       ` Oliver Kiddle [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=75344-1636894954.430445@bbTu.fE6Q.VZqQ \
    --to=opk@zsh.org \
    --cc=marlon.richert@gmail.com \
    --cc=mikachu@gmail.com \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).