help / color / mirror / code / Atom feed
From: Marlon Richert <marlon.richert@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Mikael Magnusson <mikachu@gmail.com>,
	Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Why is an 'x' appended in _prefix completer?
Date: Tue, 11 Apr 2023 12:49:05 +0300	[thread overview]
Message-ID: <CAHLkEDv3y5n0qeOUneytGOxVewHmHSBnUk1KrBChJp58EqTW0g@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1617 bytes --]

> On 8 Mar 2023, at 19:48, Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Wed, Mar 8, 2023 at 4:49 AM Mikael Magnusson <mikachu@gmail.com>
>> 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.

I brought this up, because it has bugs.

Here are two test cases, each of which uses the following setup:

% mkdir foo bar baz
% setopt completeinword
% zstyle '*' completer _complete _prefix
% autoload compinit
% compinit
% bindkey '\t' tst
% zle -C tst complete-word tst

*Case 1: Literal x is inserted into command line*

% tst() {
% file fbar
       ^ Position the cursor over here, then press Tab

This results in:
% file fooxbar

*Case 2: Wrong character is set as autoremovable suffix*

% test() {
% file bfoo
       ^ Position the cursor over here, then press Tab

This results in the following, which at first glance looks correct:
% file bar/foo

However, if you then press Space, this results in:
% file ba /foo

If you use region_highlight for the suffix, the r is highlighted as
autoremovable, too.

[-- Attachment #2: Type: text/html, Size: 5056 bytes --]

             reply	other threads:[~2023-04-11  9:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-11  9:49 Marlon Richert [this message]
  -- strict thread matches above, loose matches on Subject: below --
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

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=CAHLkEDv3y5n0qeOUneytGOxVewHmHSBnUk1KrBChJp58EqTW0g@mail.gmail.com \
    --to=marlon.richert@gmail.com \
    --cc=mikachu@gmail.com \
    --cc=schaefer@brasslantern.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).