Skip to content

Avoid clearing region_highlight on zsh 5.9+ when zsh-syntax-highlighting is absent#178

Open
Hessamshar wants to merge 1 commit into
zsh-users:masterfrom
Hessamshar:patch-1
Open

Avoid clearing region_highlight on zsh 5.9+ when zsh-syntax-highlighting is absent#178
Hessamshar wants to merge 1 commit into
zsh-users:masterfrom
Hessamshar:patch-1

Conversation

@Hessamshar
Copy link
Copy Markdown

When zsh-syntax-highlighting is not loaded, the plugin defines a fallback _zsh_highlight that clears region_highlight=() on every printable keystroke. This destroys highlights set by other plugins, most notably zsh-autosuggestions, whose suggestion text loses its styling after the second character typed.

The fallback exists to clean up stale search highlights after a substring search ends. When zsh-syntax-highlighting is present, it handles this naturally by rebuilding region_highlight on every keystroke. The fallback emulates that behavior when it's absent, but it does so by wiping the entire array, which is overly aggressive and causes collateral damage to other plugins.

@Hessamshar Hessamshar changed the title Fix: Avoid clearing region_highlight on zsh 5.9+ when zsh-syntax-highlighting is absent Avoid clearing region_highlight on zsh 5.9+ when zsh-syntax-highlighting is absent Jun 3, 2026
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.

1 participant