driver: Don't highlight in isearch
zsh version 5.2 and lower don't support ISEARCHMATCH_ACTIVE and we are unable to re-apply zle_highlight on top. Therefore it is impossible to see the underlined matched area. Since that information is more important, completely disable highlighting in isearch in that case. To do that, we need to make sure we are actually called when something changes in isearch. Trumps #257. The FAQ entry presupposes #245 will be fixed (in time for the release) too.
This commit is contained in:
committed by
Daniel Shahaf
parent
5bae621900
commit
a8fe22d422
@@ -58,6 +58,13 @@ _zsh_highlight()
|
||||
# Store the previous command return code to restore it whatever happens.
|
||||
local ret=$?
|
||||
|
||||
# Remove all highlighting in isearch, so that only the underlining done by zsh itself remains.
|
||||
# For details see FAQ entry 'Why does syntax highlighting not work while searching history?'.
|
||||
if [[ $WIDGET == zle-isearch-update ]]; then
|
||||
region_highlight=()
|
||||
return $ret
|
||||
fi
|
||||
|
||||
setopt localoptions warncreateglobal
|
||||
setopt localoptions noksharrays
|
||||
local REPLY # don't leak $REPLY into global scope
|
||||
@@ -258,6 +265,10 @@ _zsh_highlight_bind_widgets()
|
||||
# E.g. remove cursor imprint, don't highlight partial paths, ...
|
||||
widgets_to_bind+=(zle-line-finish)
|
||||
|
||||
# Always wrap special zle-isearch-update widget to be notified of updates in isearch.
|
||||
# This is needed because we need to disable highlighting in that case.
|
||||
widgets_to_bind+=(zle-isearch-update)
|
||||
|
||||
local cur_widget
|
||||
for cur_widget in $widgets_to_bind; do
|
||||
case $widgets[$cur_widget] in
|
||||
|
||||
Reference in New Issue
Block a user