zsh-users / zsh-autosuggestions

Fish-like autosuggestions for zsh
MIT License
31.1k stars 1.86k forks source link

`zle` widgets starting with `_` are ignord in `ZSH_AUTOSUGGEST_CLEAR_WIDGETS` #737

Open happenslol opened 1 year ago

happenslol commented 1 year ago

Describe the bug

Any widget that has a name starting with an underscore will not cause the prompt to be cleared. I'm not sure if this is intended behavior, but it took me quite a while to figure out why some widgets were not clearing my prompt.

To Reproduce

Steps to reproduce the behavior:

function _test() {}
zle -N test-widget _test
zle -N _test-widget _test

bindkey "^a" test-widget
bindkey "^b" _test-widget

ZSH_AUTOSUGGEST_CLEAR_WIDGETS+=('test-widget')
ZSH_AUTOSUGGEST_CLEAR_WIDGETS+=('_test-widget')

Trigger any suggestion. On pressing ^a, the suggestion is cleared, on ^b it is not.

Expected behavior

Any widget name should be able to work. Other zsh plugins I'm using add widgets that start with _, which means I currently have to rebind them to let them clear the suggestions.

Desktop