Skip to content

Commit 9ba6860

Browse files
committedAug 16, 2020
Perf: optimize parameter check
1 parent d5b6bb2 commit 9ba6860

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

Diff for: ‎highlighters/main/main-highlighter.zsh

+2-1
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,8 @@ _zsh_highlight_main_highlighter_highlight_list()
750750
fi
751751

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

0 commit comments

Comments
 (0)