zsh-autosuggestions icon indicating copy to clipboard operation
zsh-autosuggestions copied to clipboard

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

Open ElementW opened this issue 1 year ago • 7 comments

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.

ElementW avatar May 22 '24 09:05 ElementW

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

tomasnorre avatar Sep 11 '24 07:09 tomasnorre

I had the exact same problem (the zsh-autosuggestions proposed color was not changing back although it was accepted). This commit also fixed it for me. Thank you !

ErwanGarreau avatar Nov 19 '24 13:11 ErwanGarreau

This commit also fixes it for me, too. I started experiencing this issue after upgrading to Ubuntu 24.04 (from 22.04)

$  zsh --version
zsh 5.9 (x86_64-ubuntu-linux-gnu)

rylwin avatar Dec 29 '24 04:12 rylwin

also fixes it for me, #820

dolphin-cat avatar Jan 13 '25 15:01 dolphin-cat

What's preventing this from getting merged?

enoryw avatar Mar 24 '25 04:03 enoryw

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...

rieje avatar Apr 03 '25 01:04 rieje

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?

rbjorklin avatar Apr 19 '25 04:04 rbjorklin