check for v5.4 and fallback for older versions

this commit addresses versions older than 5.4 by using older widget hook method
This commit is contained in:
pushqrdx
2020-08-08 12:46:01 +02:00
parent daf9b6c1fe
commit 94717acab1
+10 -8
View File
@@ -212,14 +212,6 @@ _zsh_highlight_cursor_moved()
autoload -U add-zle-hook-widget
autoload -Uz is-at-least
# Apply syntax highlighting on init. Fixes the issue
# where coming back from push-line loses highlighting
if is-at-least 5.8.0.2; then
if [[ -o zle ]]; then
add-zle-hook-widget zle-line-init _zsh_highlight
fi
fi
# Helper for _zsh_highlight_bind_widgets
# $1 is name of widget to call
_zsh_highlight_call_widget()
@@ -257,6 +249,16 @@ _zsh_highlight_bind_widgets()
# This is needed because we need to disable highlighting in that case.
widgets_to_bind+=(zle-isearch-update)
# Apply syntax highlighting on init. Fixes the issue
# where coming back from push-line loses highlighting
if is-at-least 5.4; then
if [[ -o zle ]]; then
add-zle-hook-widget zle-line-init _zsh_highlight
fi
else
widgets_to_bind+=(zle-line-init)
fi
local cur_widget
for cur_widget in $widgets_to_bind; do
case $widgets[$cur_widget] in