-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix colors not being reset on (partial) accept w/ recent ZSH (fixes #789) #790
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
The ZSH manual describes `region_highlight` as being an array in https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting, therefore the previous strategy of removing as many characters as the last suggestion is *not* the way to do it, explaining why it broke on recent ZSH versions. Replace this logic with a simple last-element delete. Keeps the `_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT` variable intact since there's no downside in tracking its content, as it still used as a marker for whether a suggestion highlight was applied.
I can confirm that this fix solves the problem I have in #789 |
I had the exact same problem (the zsh-autosuggestions proposed color was not changing back although it was accepted). |
This commit also fixes it for me, too. I started experiencing this issue after upgrading to Ubuntu 24.04 (from 22.04)
|
also fixes it for me, #820 |
What's preventing this from getting merged? |
Fixed for me too. Can this be merged? It's nearly a year and colors being broken for an autosuggestion plugin that relies on colors is kind of essential... |
I was having the same problem until I started using the code from this PR. @ericfreese any chance you have a moment to review and merge? |
The ZSH manual describes
region_highlight
as being an array in https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting, therefore the previous strategy of removing as many characters as the last suggestion is not the way to do it, explaining why it broke on recent ZSH versions.Replace this logic with a simple last-element delete. Keeps the
_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT
variable intact since there's no downside in tracking its content, as it still used as a marker for whether a suggestion highlight was applied.Fixes #789.