help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Peter Stephenson <p.w.stephenson@ntlworld.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Why is an 'x' appended in _prefix completer?
Date: Thu, 9 Mar 2023 07:29:24 -0800	[thread overview]
Message-ID: <CAH+w=7ZamEKds0JEd95rFg5=9z-stK2-G02NNzPAB0eBBwnoLw@mail.gmail.com> (raw)
In-Reply-To: <2022992152.13489.1678353713103@mail.virginmedia.com>

On Thu, Mar 9, 2023 at 1:23 AM Peter Stephenson
<p.w.stephenson@ntlworld.com> wrote:
> > On 08/03/2023 17:48 Bart Schaefer <schaefer@brasslantern.com> wrote:
> >
> > 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 shouldn't be making this visible to shell code.

Prefix completion is in the middle of a word but without treating the
suffix as part of the word.  It's supposed to act like completion in
the middle of words in some other shell (old bash?).  So to hack that,
the _prefix completer inserts a space to the right of the cursor and
then completes as usual.  The "x" indicates where to remove the space
again when all is done.  It's not exposing the internals of compadd,
it's just using the same trick in shell code that compadd does in a
different case.

  reply	other threads:[~2023-03-09 15:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-08 10:32 Marlon Richert
2023-03-08 12:48 ` Mikael Magnusson
2023-03-08 17:48   ` Bart Schaefer
2023-03-09  9:21     ` Peter Stephenson
2023-03-09 15:29       ` Bart Schaefer [this message]
2023-04-11  9:49 Marlon Richert

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:

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

  git send-email \
    --in-reply-to='CAH+w=7ZamEKds0JEd95rFg5=9z-stK2-G02NNzPAB0eBBwnoLw@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=p.w.stephenson@ntlworld.com \
    --cc=zsh-workers@zsh.org \


* 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


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).