File tree 1 file changed +10
-5
lines changed
1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -308,11 +308,16 @@ _zsh_highlight_load_highlighters()
308
308
# Setup
309
309
# -------------------------------------------------------------------------------------------------
310
310
311
- # Try binding widgets.
312
- _zsh_highlight_bind_widgets || {
313
- echo ' zsh-syntax-highlighting: failed binding ZLE widgets, exiting.' >&2
314
- return 1
315
- }
311
+ # Use zle-line-pre-redraw if available. Otherwise try binding widgets as fallback.
312
+ autoload -Uz is-at-least
313
+ if is-at-least 5.2; then
314
+ _zsh_highlight_set_or_wrap_special_zle_widget zle-line-pre-redraw
315
+ else
316
+ _zsh_highlight_bind_widgets || {
317
+ echo ' zsh-syntax-highlighting: failed binding ZLE widgets, exiting.' >&2
318
+ return 1
319
+ }
320
+ fi
316
321
317
322
# Always wrap special zle-line-finish widget. This is needed to decide if the
318
323
# current line ends and special highlighting logic needs to be applied.
You can’t perform that action at this time.
0 commit comments