Stop leaking variables into global namespace.

Set WARN_CREATE_GLOBAL to prevent recurrence.

Fixes zsh-users/zsh-syntax-highlighting#192.
This commit is contained in:
Daniel Shahaf 2015-09-24 17:57:59 +00:00
parent 1467eae86d
commit 908c4fe150
2 changed files with 4 additions and 3 deletions

View file

@ -261,6 +261,7 @@ _zsh_highlight_main_highlighter_highlight_string()
{ {
setopt localoptions noksharrays setopt localoptions noksharrays
local i j k style varflag local i j k style varflag
local AA
# Starting quote is at 1, so start parsing at offset 2 in the string. # Starting quote is at 1, so start parsing at offset 2 in the string.
for (( i = 2 ; i < end_pos - start_pos ; i += 1 )) ; do for (( i = 2 ; i < end_pos - start_pos ; i += 1 )) ; do
(( j = i + start_pos - 1 )) (( j = i + start_pos - 1 ))

View file

@ -45,7 +45,7 @@ _zsh_highlight()
# Store the previous command return code to restore it whatever happens. # Store the previous command return code to restore it whatever happens.
local ret=$? local ret=$?
setopt localoptions nowarncreateglobal setopt localoptions warncreateglobal
# Do not highlight if there are more than 300 chars in the buffer. It's most # Do not highlight if there are more than 300 chars in the buffer. It's most
# likely a pasted command or a huge list of files in that case.. # likely a pasted command or a huge list of files in that case..
@ -125,8 +125,8 @@ _zsh_highlight()
} always { } always {
_ZSH_HIGHLIGHT_PRIOR_BUFFER=$BUFFER typeset -g _ZSH_HIGHLIGHT_PRIOR_BUFFER=$BUFFER
_ZSH_HIGHLIGHT_PRIOR_CURSOR=$CURSOR typeset -gi _ZSH_HIGHLIGHT_PRIOR_CURSOR=$CURSOR
} }
} }