Skip to content

Commit 78c94cf

Browse files
committed
Fix a bug whereby the 'assign' style would be added twice.
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. In particular, 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.
1 parent 9e01716 commit 78c94cf

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
@@ -831,7 +831,7 @@ _zsh_highlight_main_highlighter_highlight_list()
831831
function) style=function;;
832832
command) style=command;;
833833
hashed) style=hashed-command;;
834-
none) if _zsh_highlight_main_highlighter_check_assign; then
834+
none) if (( ! in_param )) && _zsh_highlight_main_highlighter_check_assign; then
835835
_zsh_highlight_main_add_region_highlight $start_pos $end_pos assign
836836
local i=$(( arg[(i)=] + 1 ))
837837
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)