Fix bug in previous commit (d330b49b33bed50e295dee6850ac46136ff29372)

'local' is a reserved word in zsh 5.1 but not in earlier versions [1].
Therefore, under zsh older than 5.1, quoting is required.

This manifested as random «builtin=''» in emitted to the terminal, and
commands (such as 'echo') highlighted as errors (in red).

[1] https://github.com/zsh-users/zsh/blob/master/README#L46
    (the section "Incompatibilites between 5.0.8 and 5.1")
This commit is contained in:
Daniel Shahaf 2015-09-07 01:26:11 +00:00
parent d330b49b33
commit a0b5bc6c71

View File

@ -147,7 +147,7 @@ _zsh_highlight_main_highlighter()
style=$ZSH_HIGHLIGHT_STYLES[precommand] style=$ZSH_HIGHLIGHT_STYLES[precommand]
sudo=true sudo=true
else else
local res=$(LC_ALL=C builtin type -w $arg 2>/dev/null) local res="$(LC_ALL=C builtin type -w $arg 2>/dev/null)"
case $res in case $res in
*': reserved') style=$ZSH_HIGHLIGHT_STYLES[reserved-word];; *': reserved') style=$ZSH_HIGHLIGHT_STYLES[reserved-word];;
*': alias') style=$ZSH_HIGHLIGHT_STYLES[alias] *': alias') style=$ZSH_HIGHLIGHT_STYLES[alias]