driver: Workaround pattern isearch bug in zsh ≤ 5.3.1, already fixed upstream.

Merge remote-tracking branch 'upstream/pr/415'

* upstream/pr/415:
  workaround for PAT_STATIC bug in zsh
This commit is contained in:
Daniel Shahaf
2017-03-29 09:18:59 +00:00
2 changed files with 19 additions and 7 deletions

View File

@@ -53,6 +53,15 @@ fi
# Core highlighting update system
# -------------------------------------------------------------------------------------------------
# Use workaround for bug in ZSH?
# zsh-users/zsh@48cadf4 http://www.zsh.org/mla/workers//2017/msg00034.html
autoload -U is-at-least
if is-at-least 5.3.2; then
zsh_highlight__pat_static_bug=false
else
zsh_highlight__pat_static_bug=true
fi
# Array declaring active highlighters names.
typeset -ga ZSH_HIGHLIGHT_HIGHLIGHTERS
@@ -67,7 +76,9 @@ _zsh_highlight()
# 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 ]] && ! (( $+ISEARCHMATCH_ACTIVE )); then
# This disables highlighting during isearch (for reasons explained in README.md) unless zsh is new enough
# and doesn't have the 5.3.1 bug
if [[ $WIDGET == zle-isearch-update ]] && { $zsh_highlight__pat_static_bug || ! (( $+ISEARCHMATCH_ACTIVE )) }; then
region_highlight=()
return $ret
fi
@@ -395,8 +406,6 @@ add-zsh-hook preexec _zsh_highlight_preexec_hook 2>/dev/null || {
# Load zsh/parameter module if available
zmodload zsh/parameter 2>/dev/null || true
autoload -U is-at-least
# Initialize the array of active highlighters if needed.
[[ $#ZSH_HIGHLIGHT_HIGHLIGHTERS -eq 0 ]] && ZSH_HIGHLIGHT_HIGHLIGHTERS=(main)