Don't parse first word of array assignment as command
Fixes zsh-users/zsh-syntax-highlighting#178
This commit is contained in:
parent
3dc5741900
commit
b9b67b9f78
@ -125,7 +125,11 @@ _zsh_highlight_main_highlighter()
|
|||||||
*': hashed') style=$ZSH_HIGHLIGHT_STYLES[hashed-command];;
|
*': hashed') style=$ZSH_HIGHLIGHT_STYLES[hashed-command];;
|
||||||
*) if _zsh_highlight_main_highlighter_check_assign; then
|
*) if _zsh_highlight_main_highlighter_check_assign; then
|
||||||
style=$ZSH_HIGHLIGHT_STYLES[assign]
|
style=$ZSH_HIGHLIGHT_STYLES[assign]
|
||||||
new_expression=true
|
if [[ $arg[-1] != '(' ]]; then
|
||||||
|
# assignment to a scalar parameter.
|
||||||
|
# (For array assignments, the command doesn't start until the ")" token.)
|
||||||
|
new_expression=true
|
||||||
|
fi
|
||||||
elif _zsh_highlight_main_highlighter_check_path; then
|
elif _zsh_highlight_main_highlighter_check_path; then
|
||||||
style=$ZSH_HIGHLIGHT_STYLES[path]
|
style=$ZSH_HIGHLIGHT_STYLES[path]
|
||||||
elif [[ $arg[0,1] == $histchars[0,1] || $arg[0,1] == $histchars[2,2] ]]; then
|
elif [[ $arg[0,1] == $histchars[0,1] || $arg[0,1] == $histchars[2,2] ]]; then
|
||||||
|
@ -28,8 +28,9 @@
|
|||||||
# vim: ft=zsh sw=2 ts=2 et
|
# vim: ft=zsh sw=2 ts=2 et
|
||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
BUFFER='A=1'
|
BUFFER='A=1 b=("foo" bar)'
|
||||||
|
|
||||||
expected_region_highlight=(
|
expected_region_highlight=(
|
||||||
"1 3 $ZSH_HIGHLIGHT_STYLES[assign]" # A=1
|
"1 3 $ZSH_HIGHLIGHT_STYLES[assign]" # A=1
|
||||||
|
"8 12 $ZSH_HIGHLIGHT_STYLES[double-quoted-argument]" # "foo"
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user