From 74a27de70d7d21e92a50a6398a5eeeb12b884a4f Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 29 Jul 2016 20:32:29 +0000 Subject: [PATCH] driver: Hook zle-line-finish. Compare issue #288. --- zsh-syntax-highlighting.zsh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/zsh-syntax-highlighting.zsh b/zsh-syntax-highlighting.zsh index 8476c1a..1f5b827 100644 --- a/zsh-syntax-highlighting.zsh +++ b/zsh-syntax-highlighting.zsh @@ -365,9 +365,20 @@ _zsh_highlight_bind_widgets() } if (( $zsh_highlight_use_redrawhook )); then + _zsh_highlight__zle-line-finish() { + # Reset $WIDGET since the 'main' highlighter depends on it. + # + # A nested function is required to hide zle parameters; see + # "User-defined widgets" in zshall. + () { + local -h +r WIDGET=zle-line-finish + _zsh_highlight "$@" + } + } _zsh_highlight_bind_widgets(){} if [[ -o zle ]]; then add-zle-hook-widget zle-line-pre-redraw _zsh_highlight + add-zle-hook-widget zle-line-finish _zsh_highlight__zle-line-finish fi fi