Skip to content

Commit 9ba6860

Browse files
committed
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

highlighters/main/main-highlighter.zsh

Lines changed: 2 additions & 1 deletion
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)