Skip to content

Commit 85e62a8

Browse files
danielshahafphy1729
authored andcommitted
driver: Reimplement using 'add-zle-hook-widget zle-line-pre-redraw'
This feature will be released in zsh 5.3. Older zsh's will use the existing codepath.
1 parent aed99f6 commit 85e62a8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

zsh-syntax-highlighting.zsh

+6-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ if true; then
5050
fi
5151

5252
integer zsh_highlight_use_redrawhook
53-
if zle -la .match-bracket; then
53+
if autoload -U +X -- add-zle-hook-widget 2>/dev/null;
54+
[[ "${${(@f)"$(which -- add-zle-hook-widget)"}[2]}" != $'\t'$histchars[3]' undefined' ]];
55+
then
5456
(( zsh_highlight_use_redrawhook=1 ))
5557
fi
5658

@@ -364,7 +366,9 @@ _zsh_highlight_bind_widgets()
364366

365367
if (( $zsh_highlight_use_redrawhook )); then
366368
_zsh_highlight_bind_widgets(){}
367-
zle -N zle-line-pre-redraw _zsh_highlight
369+
if [[ -o zle ]]; then
370+
add-zle-hook-widget zle-line-pre-redraw _zsh_highlight
371+
fi
368372
fi
369373

370374
# Load highlighters from directory.

0 commit comments

Comments
 (0)