zsh-workers
 help / color / mirror / code / Atom feed
* [BUG] compadd -R callback function not triggered by custom widget
@ 2023-11-06 11:48 Marlon Richert
  2023-11-06 21:53 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Marlon Richert @ 2023-11-06 11:48 UTC (permalink / raw)
  To: Zsh hackers list

[-- 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 --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-11-06 21:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-06 11:48 [BUG] compadd -R callback function not triggered by custom widget Marlon Richert
2023-11-06 21:53 ` Bart Schaefer

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