zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Marlon Richert <marlon.richert@gmail.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [BUG] compadd -R callback function not triggered by custom widget
Date: Mon, 6 Nov 2023 13:53:09 -0800	[thread overview]
Message-ID: <CAH+w=7aqVCtc2fb3ptUYh8fKeECPKvRbsSnRTsJnX=ukdPeSGg@mail.gmail.com> (raw)
In-Reply-To: <CAHLkEDuXv7BfF_3eNDQE4FHmrUE5NVU5gNL6jzL996EW1Es3Hg@mail.gmail.com>

On Mon, Nov 6, 2023 at 3:49 AM Marlon Richert <marlon.richert@gmail.com> wrote:
>
> However, if we do not call any built-in widget inside our custom widget,
> then tst-suffix does not get called:

I believe this is because you're in the menuselect keymap, which
supports only a limited set of operations.  When you hit ESC-i at this
point without invoking any zle operations, you are still in menu mode,
so the existing suffix is still active.  You can see this if you
immediately hit TAB again twice -- "asuffix" is replaced by "bsuffix"
and the cursor is back at the end of the line again.  Suffix removal
is not invoked because as far as zle knows, you've never left the
menu.

If you call a builtin from tst-custom, the menu is aborted and you're
back at the top-level.

This could still be considered a bug -- changing CURSOR and possibly
some other ZLE parameters during menu completion should also abort the
menu.

> Interestingly, if we then activate a built-in widget right after,
> then tst-suffix gets called after all, but with the wrong value:
>
> # press Space
> % len=0 : asuffix

This actually isn't wrong (given the foregoing) -- Space breaks out of
menu completion, so the suffix removal is invoked, and at that moment
the cursor is at the beginning of the line so there is no LBUFFER so
len=0.


      reply	other threads:[~2023-11-06 21:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-06 11:48 Marlon Richert
2023-11-06 21:53 ` Bart Schaefer [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='CAH+w=7aqVCtc2fb3ptUYh8fKeECPKvRbsSnRTsJnX=ukdPeSGg@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=marlon.richert@gmail.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).