fix search match highlight with latest z-sy-h
Search highlight is cleared after a timeout, which is one second by default. Timeout period can be changed by setting an environment variable; example below for setting one minute timeout. HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_TIMEOUT=60 Fixes #131
This commit is contained in:
parent
400e58a87f
commit
da5f0673b9
2 changed files with 20 additions and 0 deletions
|
|
@ -408,6 +408,23 @@ _history-substring-search-end() {
|
|||
# zle -R "mn: "$_history_substring_search_match_index" m#: "${#_history_substring_search_matches}
|
||||
# read -k -t 200 && zle -U $REPLY
|
||||
|
||||
#
|
||||
# When this function returns, z-sy-h runs its line-pre-redraw hook. It has no
|
||||
# logic for determining highlight priority, when two different memo= marked
|
||||
# region highlights overlap; instead, it always prioritises itself. Below is
|
||||
# a workaround for dealing with it.
|
||||
#
|
||||
if [[ $_history_substring_search_zsh_5_9 -eq 1 ]]; then
|
||||
zle -R
|
||||
#
|
||||
# After line redraw with desired highlight, wait for timeout or user input
|
||||
# before removing search highlight and exiting. This ensures no highlights
|
||||
# are left lingering after search is finished.
|
||||
#
|
||||
read -k -t ${HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_TIMEOUT:-1} && zle -U $REPLY
|
||||
region_highlight=( "${(@)region_highlight:#*${highlight_memo}*}" )
|
||||
fi
|
||||
|
||||
# Exit successfully from the history-substring-search-* widgets.
|
||||
return 0
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue