Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[BUG] compadd -R callback function not triggered by custom widget



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



Messages sorted by: Reverse Date, Date, Thread, Author