@@ -108,12 +108,28 @@ else
108108 typeset -g zsh_highlight__pat_static_bug=true
109109fi
110110
111- # Probe the memo= feature, once. When this anonymous function returns,
112- # $zsh_highlight__memo_feature will be set (either to 0 or to 1).
113- () {
114- # Provide a mock $region_highlight. (The test suite's mock might not have been set up yet.)
115- (( ${+region_highlight} )) || typeset -a region_highlight
111+ # Array declaring active highlighters names.
112+ typeset -ga ZSH_HIGHLIGHT_HIGHLIGHTERS
116113
114+ # Update ZLE buffer syntax highlighting.
115+ #
116+ # Invokes each highlighter that needs updating.
117+ # This function is supposed to be called whenever the ZLE state changes.
118+ _zsh_highlight ()
119+ {
120+ # Store the previous command return code to restore it whatever happens.
121+ local ret=$?
122+ # Make it read-only. Can't combine this with the previous line when POSIX_BUILTINS may be set.
123+ typeset -r ret
124+
125+ # $region_highlight should be predefined, either by zle or by the test suite's mock (non-special) array.
126+ (( ${+region_highlight} )) || {
127+ echo >&2 ' zsh-syntax-highlighting: error: $region_highlight is not defined'
128+ echo >&2 ' zsh-syntax-highlighting: (Check whether zsh-syntax-highlighting was installed according to the instructions.)'
129+ return $ret
130+ }
131+
132+ # Probe the memo= feature, once.
117133 (( ${+zsh_highlight__memo_feature} )) || {
118134 region_highlight+=( " 0 0 fg=red, memo=zsh-syntax-highlighting" )
119135 case ${region_highlight[-1]} in
156172 esac
157173 region_highlight[-1]=()
158174 }
159- }
160-
161- # Array declaring active highlighters names.
162- typeset -ga ZSH_HIGHLIGHT_HIGHLIGHTERS
163-
164- # Update ZLE buffer syntax highlighting.
165- #
166- # Invokes each highlighter that needs updating.
167- # This function is supposed to be called whenever the ZLE state changes.
168- _zsh_highlight ()
169- {
170- # Store the previous command return code to restore it whatever happens.
171- local ret=$?
172- # Make it read-only. Can't combine this with the previous line when POSIX_BUILTINS may be set.
173- typeset -r ret
174-
175- # $region_highlight should be predefined, either by zle or by the test suite's mock (non-special) array.
176- (( ${+region_highlight} )) || {
177- echo >&2 ' zsh-syntax-highlighting: error: $region_highlight is not defined'
178- echo >&2 ' zsh-syntax-highlighting: (Check whether zsh-syntax-highlighting was installed according to the instructions.)'
179- return $ret
180- }
181175
182176 # Reset region_highlight to build it from scratch
183177 if (( zsh_highlight__memo_feature )) ; then
0 commit comments