zsh-users / zsh-autosuggestions

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

Allow wrapping widgets whose name start with _ (underscore) #749

Open toadjaune opened 1 year ago

toadjaune commented 1 year ago

Hi folks,

When creating a zle widget whose name starts with _, it is ignored by zsh-autosuggestions, leading to various situations where the suggestion should be refreshed, but isn't.

Typically, other plugins often create such widgets, making them incompatible with zsh-autosuggestions.

This PR changes this.

Preliminary testing seems to indicate everything works fine on my machine, and before going through more extensive testing and/or writing tests, I wanted to ask if there's a specific reason to forbid wrapping such widgets.

It looks like the current presence check is not a mistake, but a voluntary design, but I can't understand why. As far as I can tell, the only reason to ban such widget names, is to prevent wrapping an already-wrapped widget. Which the proposed change still does.

https://github.com/zsh-users/zsh-autosuggestions/issues/737 is a manifestation of this issue, and provides a nice minimal reproducing example (although the problem is bigger than stated there, as it affects all types of widget wrapping)

If we go through with this change, it would likely require a 0.8.0 tag, as suddenly starting to wrap previously-unwrapped widgets may break unexpectedly on specific edge cases. It is however possible for users with such a setup to reproduce the current behavior with ZSH_AUTOSUGGEST_IGNORE_WIDGETS, so, it's not a blocking change.

Please let me know if I've missed the rationale behind the current design !

norman-zon commented 1 year ago

Any chance of having this merged an released soon?

norman-zon commented 1 month ago

bump?