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 @@ -281,11 +281,16 @@ _zsh_highlight_load_highlighters()
281
281
# Setup
282
282
# -------------------------------------------------------------------------------------------------
283
283
284
- # Try binding widgets.
285
- _zsh_highlight_bind_widgets || {
286
- echo ' zsh-syntax-highlighting: failed binding ZLE widgets, exiting.' >&2
287
- return 1
288
- }
284
+ # Use zle-line-pre-redraw if available. Otherwise try binding widgets as fallback.
285
+ autoload -Uz is-at-least
286
+ if is-at-least 5.2; then
287
+ zle -N zle-line-pre-redraw _zsh_highlight
288
+ else
289
+ _zsh_highlight_bind_widgets || {
290
+ echo ' zsh-syntax-highlighting: failed binding ZLE widgets, exiting.' >&2
291
+ return 1
292
+ }
293
+ fi
289
294
290
295
# Resolve highlighters directory location.
291
296
_zsh_highlight_load_highlighters " ${ZSH_HIGHLIGHT_HIGHLIGHTERS_DIR:- ${${0: A} : h} / highlighters} " || {
You can’t perform that action at this time.
0 commit comments