Skip to content

Commit a747058

Browse files
committed
driver: Hook zle-line-finish.
Compare issue zsh-users#288.
1 parent 98aab20 commit a747058

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

zsh-syntax-highlighting.zsh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,19 @@ _zsh_highlight_bind_widgets()
276276
}
277277

278278
if (( $zsh_highlight_use_redrawhook )); then
279+
_zsh_highlight__zle-line-finish() {
280+
# Reset $WIDGET since the 'main' highlighter depends on it.
281+
#
282+
# A nested function is required to hide zle parameters; see
283+
# "User-defined widgets" in zshall.
284+
() {
285+
local -h +r WIDGET=zle-line-finish
286+
_zsh_highlight "$@"
287+
}
288+
}
279289
_zsh_highlight_bind_widgets(){}
280290
add-zle-hook-widget zle-line-pre-redraw _zsh_highlight
291+
add-zle-hook-widget zle-line-finish _zsh_highlight__zle-line-finish
281292
fi
282293

283294
# Load highlighters from directory.

0 commit comments

Comments
 (0)