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

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



On Mon, Nov 6, 2023 at 3:49 AM Marlon Richert <marlon.richert@xxxxxxxxx> 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.




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