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.
This commit is contained in:
Daniel Shahaf 2016-06-15 23:26:23 +00:00 committed by Matthew Martin
parent aed99f6a3e
commit 85e62a8171
1 changed files with 6 additions and 2 deletions

View File

@ -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
@ -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.