Merge remote-tracking branch 'origin/master' into feature/redrawhook

* origin/master:
  Revert "driver: Move the initialization of $zsh_highlight__memo_feature out of the entry point function."
This commit is contained in:
Daniel Shahaf 2020-07-14 02:31:24 +00:00
commit 9ce3540d74

View file

@ -108,12 +108,28 @@ else
typeset -g zsh_highlight__pat_static_bug=true typeset -g zsh_highlight__pat_static_bug=true
fi fi
# Probe the memo= feature, once. When this anonymous function returns, # Array declaring active highlighters names.
# $zsh_highlight__memo_feature will be set (either to 0 or to 1). typeset -ga ZSH_HIGHLIGHT_HIGHLIGHTERS
() {
# Provide a mock $region_highlight. (The test suite's mock might not have been set up yet.)
(( ${+region_highlight} )) || typeset -a region_highlight
# Update ZLE buffer syntax highlighting.
#
# Invokes each highlighter that needs updating.
# This function is supposed to be called whenever the ZLE state changes.
_zsh_highlight()
{
# Store the previous command return code to restore it whatever happens.
local ret=$?
# Make it read-only. Can't combine this with the previous line when POSIX_BUILTINS may be set.
typeset -r ret
# $region_highlight should be predefined, either by zle or by the test suite's mock (non-special) array.
(( ${+region_highlight} )) || {
echo >&2 'zsh-syntax-highlighting: error: $region_highlight is not defined'
echo >&2 'zsh-syntax-highlighting: (Check whether zsh-syntax-highlighting was installed according to the instructions.)'
return $ret
}
# Probe the memo= feature, once.
(( ${+zsh_highlight__memo_feature} )) || { (( ${+zsh_highlight__memo_feature} )) || {
region_highlight+=( " 0 0 fg=red, memo=zsh-syntax-highlighting" ) region_highlight+=( " 0 0 fg=red, memo=zsh-syntax-highlighting" )
case ${region_highlight[-1]} in case ${region_highlight[-1]} in
@ -156,28 +172,6 @@ fi
esac esac
region_highlight[-1]=() region_highlight[-1]=()
} }
}
# Array declaring active highlighters names.
typeset -ga ZSH_HIGHLIGHT_HIGHLIGHTERS
# Update ZLE buffer syntax highlighting.
#
# Invokes each highlighter that needs updating.
# This function is supposed to be called whenever the ZLE state changes.
_zsh_highlight()
{
# Store the previous command return code to restore it whatever happens.
local ret=$?
# Make it read-only. Can't combine this with the previous line when POSIX_BUILTINS may be set.
typeset -r ret
# $region_highlight should be predefined, either by zle or by the test suite's mock (non-special) array.
(( ${+region_highlight} )) || {
echo >&2 'zsh-syntax-highlighting: error: $region_highlight is not defined'
echo >&2 'zsh-syntax-highlighting: (Check whether zsh-syntax-highlighting was installed according to the instructions.)'
return $ret
}
# Reset region_highlight to build it from scratch # Reset region_highlight to build it from scratch
if (( zsh_highlight__memo_feature )); then if (( zsh_highlight__memo_feature )); then