Skip to content

Commit

Permalink
driver: Reimplement using 'add-zle-hook-widget zle-line-pre-redraw'
Browse files Browse the repository at this point in the history
This feature will be released in zsh 5.3.  Older zsh's will use the existing
codepath.
  • Loading branch information
danielshahaf authored and phy1729 committed Oct 21, 2018
1 parent 63d2222 commit 75e57cc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions zsh-syntax-highlighting.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ if true; then
fi

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

Expand Down Expand Up @@ -364,7 +366,9 @@ _zsh_highlight_bind_widgets()

if (( $zsh_highlight_use_redrawhook )); then
_zsh_highlight_bind_widgets(){}
zle -N zle-line-pre-redraw _zsh_highlight
if [[ -o zle ]]; then
add-zle-hook-widget zle-line-pre-redraw _zsh_highlight
fi
fi

# Load highlighters from directory.
Expand Down

0 comments on commit 75e57cc

Please sign in to comment.