From: Marlon Richert <marlon.richert@gmail.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: [BUG] compadd -R callback function not triggered by custom widget
Date: Mon, 6 Nov 2023 13:48:29 +0200 [thread overview]
Message-ID: <CAHLkEDuXv7BfF_3eNDQE4FHmrUE5NVU5gNL6jzL996EW1Es3Hg@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1019 bytes --]
Given this setup:
% zmodload zsh/complist
% autoload compinit
% compinit
% bindkey '^I' tst-complete
% zle -C tst-complete menu-select tst-complete
% tst-complete() { compadd -Ssuffix -R tst-suffix -- a b }
% tst-suffix() { LBUFFER+="len=$1" }
% bindkey '^[i' tst-custom
% zle -N tst-custom
% tst-custom() { zle beginning-of-line }
Then the following is expected behavior:
# press `:`+Space+Tab
% : asuffix
a b
# completion menu opened
# press Escape+`i`
% : asuffixlen=6
# tst-suffix was called and cursor was moved to beginning of line
However, if we do not call any built-in widget inside our custom widget,
then tst-suffix does not get called:
% tst-custom() { CURSOR=0 }
# press `:`+Space+Tab
% : asuffix
a b
# completion menu opened
# press Escape+`i`
% : asuffix
# cursor was moved to beginning of line, but tst-suffix was not called
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
[-- Attachment #2: Type: text/html, Size: 3365 bytes --]
next reply other threads:[~2023-11-06 11:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-06 11:48 Marlon Richert [this message]
2023-11-06 21:53 ` 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:
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=CAHLkEDuXv7BfF_3eNDQE4FHmrUE5NVU5gNL6jzL996EW1Es3Hg@mail.gmail.com \
--to=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).