Skip to content

Commit e1bd1ad

Browse files
committed
'main': Parameter expansions may not contain assignments.
In «a="b=c"; $a», the '=' sign in the expansion of $a is not active. Therefore, prevent the expansion of $a from being considered an assignment. Update test expectations accordingly.
1 parent e957852 commit e1bd1ad

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

highlighters/main/main-highlighter.zsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@ _zsh_highlight_main_highlighter_highlight_list()
840840
function) style=function;;
841841
command) style=command;;
842842
hashed) style=hashed-command;;
843-
none) if _zsh_highlight_main_highlighter_check_assign; then
843+
none) if (( ! in_param )) && _zsh_highlight_main_highlighter_check_assign; then
844844
_zsh_highlight_main_add_region_highlight $start_pos $end_pos assign
845845
local i=$(( arg[(i)=] + 1 ))
846846
if [[ $arg[i] == '(' ]]; then

highlighters/main/test-data/parameter-value-contains-command-position1.zsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ BUFFER=$'$foobar'
3434

3535
expected_region_highlight=(
3636
# Used to highlight the "ba" as 'command' because the 'ls' showed through; issues #670 and #674
37-
'1 7 assign' # $foobar
37+
'1 7 unknown-token' # $foobar (not an assignment)
3838
)

highlighters/main/test-data/parameter-value-contains-command-position2.zsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ BUFFER=$'$y'
3434

3535
expected_region_highlight=(
3636
# Used to trigger a "BUG" message on stderr - issues #670 and #674
37-
'1 2 assign' # $y
37+
'1 2 unknown-token' # $y (not an assignment)
3838
)

0 commit comments

Comments
 (0)