Perf: optimize parameter check

This commit is contained in:
Roman Perepelitsa 2020-08-16 13:49:07 +02:00
parent f063829450
commit 5ac6f101fd

View File

@ -750,7 +750,8 @@ _zsh_highlight_main_highlighter_highlight_list()
fi
# Expand parameters.
if (( ! in_param )) && _zsh_highlight_main_highlighter__try_expand_parameter "$arg"; then
if (( ! in_param )) && [[ $arg == \$* ]] &&
_zsh_highlight_main_highlighter__try_expand_parameter "$arg"; then
# That's not entirely correct --- if the parameter's value happens to be a reserved
# word, the parameter expansion will be highlighted as a reserved word --- but that
# incorrectness is outweighed by the usability improvement of permitting the use of