From 04c3df512a7f8bb4e82562e1421daf71d164bda9 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 13 Mar 2012 17:08:45 -0400 Subject: [PATCH] Retain search query highlight on cursor move @guidovansteen discovered inconsistent behaviour when zsh-syntax-highlighting is not sourced prior to zsh-history-substring-search. https://github.com/zsh-users/zsh-history-substring-search/issues/9 @sunaku wrote this patch. --- .../history-substring-search.zsh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/history-substring-search/history-substring-search.zsh b/plugins/history-substring-search/history-substring-search.zsh index bcf983c..affe9de 100644 --- a/plugins/history-substring-search/history-substring-search.zsh +++ b/plugins/history-substring-search/history-substring-search.zsh @@ -89,11 +89,14 @@ zmodload -F zsh/parameter # if [[ $+functions[_zsh_highlight] -eq 0 ]]; then # - # Dummy implementation of _zsh_highlight() - # that simply removes existing highlights + # Dummy implementation of _zsh_highlight() that + # simply removes any existing highlights when the + # user inserts printable characters into $BUFFER. # function _zsh_highlight() { - region_highlight=() + if [[ $KEYS == [[:print:]] ]]; then + region_highlight=() + fi } #