Skip to content

Commit 74a27de

Browse files
danielshahafphy1729
authored andcommitted
driver: Hook zle-line-finish.
Compare issue #288.
1 parent 85e62a8 commit 74a27de

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

zsh-syntax-highlighting.zsh

+11
Original file line numberDiff line numberDiff line change
@@ -365,9 +365,20 @@ _zsh_highlight_bind_widgets()
365365
}
366366

367367
if (( $zsh_highlight_use_redrawhook )); then
368+
_zsh_highlight__zle-line-finish() {
369+
# Reset $WIDGET since the 'main' highlighter depends on it.
370+
#
371+
# A nested function is required to hide zle parameters; see
372+
# "User-defined widgets" in zshall.
373+
() {
374+
local -h +r WIDGET=zle-line-finish
375+
_zsh_highlight "$@"
376+
}
377+
}
368378
_zsh_highlight_bind_widgets(){}
369379
if [[ -o zle ]]; then
370380
add-zle-hook-widget zle-line-pre-redraw _zsh_highlight
381+
add-zle-hook-widget zle-line-finish _zsh_highlight__zle-line-finish
371382
fi
372383
fi
373384

0 commit comments

Comments
 (0)