Skip to content

Commit aa56129

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. As a side effect, this prevents line 836 from firing for the cases in these two tests, thereby fixing the double $region_highlight addition (see log message of the previous commit). That leaves the line 966 addition. However, the double addition remains a latent bug (see discussion in PR zsh-users#684).
1 parent bc3b943 commit aa56129

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

highlighters/main/main-highlighter.zsh

+1-1
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,7 @@ _zsh_highlight_main_highlighter_highlight_list()
839839
function) style=function;;
840840
command) style=command;;
841841
hashed) style=hashed-command;;
842-
none) if _zsh_highlight_main_highlighter_check_assign; then
842+
none) if (( ! in_param )) && _zsh_highlight_main_highlighter_check_assign; then
843843
_zsh_highlight_main_add_region_highlight $start_pos $end_pos assign
844844
local i=$(( arg[(i)=] + 1 ))
845845
if [[ $arg[i] == '(' ]]; then

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

+1-1
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

+1-1
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)