mirror of
https://github.com/zsh-users/zsh-syntax-highlighting.git
synced 2025-02-06 09:55:31 +08:00
'main': Do not look for metacharacters in parameter expansions.
Fixes the bug the previous commit added a test for.
This commit is contained in:
parent
f490b7cb95
commit
f729726300
@ -861,11 +861,14 @@ _zsh_highlight_main_highlighter_highlight_list()
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
continue
|
continue
|
||||||
elif [[ $arg[0,1] = $histchars[0,1] ]] && (( $#arg[0,2] == 2 )); then
|
elif (( ! in_param )) &&
|
||||||
|
[[ $arg[0,1] = $histchars[0,1] ]] && (( $#arg[0,2] == 2 )); then
|
||||||
style=history-expansion
|
style=history-expansion
|
||||||
elif [[ $arg[0,1] == $histchars[2,2] ]]; then
|
elif (( ! in_param )) &&
|
||||||
|
[[ $arg[0,1] == $histchars[2,2] ]]; then
|
||||||
style=history-expansion
|
style=history-expansion
|
||||||
elif [[ $arg[1,2] == '((' ]]; then
|
elif (( ! in_param )) &&
|
||||||
|
[[ $arg[1,2] == '((' ]]; then
|
||||||
# Arithmetic evaluation.
|
# Arithmetic evaluation.
|
||||||
#
|
#
|
||||||
# Note: prior to zsh-5.1.1-52-g4bed2cf (workers/36669), the ${(z)...}
|
# Note: prior to zsh-5.1.1-52-g4bed2cf (workers/36669), the ${(z)...}
|
||||||
@ -880,14 +883,17 @@ _zsh_highlight_main_highlighter_highlight_list()
|
|||||||
_zsh_highlight_main_add_region_highlight $((end_pos - 2)) $end_pos reserved-word
|
_zsh_highlight_main_add_region_highlight $((end_pos - 2)) $end_pos reserved-word
|
||||||
fi
|
fi
|
||||||
continue
|
continue
|
||||||
elif [[ $arg == '()' ]]; then
|
elif (( ! in_param )) &&
|
||||||
|
[[ $arg == '()' ]]; then
|
||||||
# anonymous function
|
# anonymous function
|
||||||
style=reserved-word
|
style=reserved-word
|
||||||
elif [[ $arg == $'\x28' ]]; then
|
elif (( ! in_param )) &&
|
||||||
|
[[ $arg == $'\x28' ]]; then
|
||||||
# subshell
|
# subshell
|
||||||
style=reserved-word
|
style=reserved-word
|
||||||
braces_stack='R'"$braces_stack"
|
braces_stack='R'"$braces_stack"
|
||||||
elif [[ $arg == $'\x29' ]]; then
|
elif (( ! in_param )) &&
|
||||||
|
[[ $arg == $'\x29' ]]; then
|
||||||
# end of subshell or command substitution
|
# end of subshell or command substitution
|
||||||
if _zsh_highlight_main__stack_pop 'S'; then
|
if _zsh_highlight_main__stack_pop 'S'; then
|
||||||
REPLY=$start_pos
|
REPLY=$start_pos
|
||||||
|
@ -33,6 +33,6 @@ local x="()"
|
|||||||
BUFFER=$'$x ls'
|
BUFFER=$'$x ls'
|
||||||
|
|
||||||
expected_region_highlight=(
|
expected_region_highlight=(
|
||||||
'1 2 unknown-token "fixed in the next commit"' # $x
|
'1 2 unknown-token' # $x
|
||||||
'4 5 command' # ls
|
'4 5 command' # ls
|
||||||
)
|
)
|
||||||
|
@ -33,6 +33,6 @@ local x="^foo^bar"
|
|||||||
BUFFER=$'$x ls'
|
BUFFER=$'$x ls'
|
||||||
|
|
||||||
expected_region_highlight=(
|
expected_region_highlight=(
|
||||||
'1 2 unknown-token "fixed in the next commit"' # $x
|
'1 2 unknown-token' # $x
|
||||||
'4 5 default' # ls
|
'4 5 default' # ls
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user