Skip to content
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

Fix colors not being reset on (partial) accept w/ recent ZSH (fixes #789) #790

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ElementW
Copy link

@ElementW ElementW commented May 22, 2024

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.

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.
@tomasnorre
Copy link

I can confirm that this fix solves the problem I have in #789

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Coloring doesn't change on auto suggestions
2 participants