Skip to content

Commit 4285cce

Browse files
msftrncsdaxian-dbw
authored andcommitted
Fix the color of operator token in the ArgumentMode (#1003)
1 parent 74b5b42 commit 4285cce

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

PSReadLine/Render.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ private string GetTokenColor(Token token)
663663
return _options._keywordColor;
664664
}
665665

666-
if ((token.TokenFlags & (TokenFlags.BinaryOperator | TokenFlags.UnaryOperator | TokenFlags.AssignmentOperator)) != 0)
666+
if (token.Kind != TokenKind.Generic && (token.TokenFlags & (TokenFlags.BinaryOperator | TokenFlags.UnaryOperator | TokenFlags.AssignmentOperator)) != 0)
667667
{
668668
return _options._operatorColor;
669669
}

test/RenderTest.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public void Render()
3737
TestSetup(KeyMode.Cmd);
3838

3939
Test("", Keys(
40-
"abc -def <#123#> \"hello $name\"",
40+
"abc -def <#123#> \"hello $name\" 1 + (1-2)",
4141
_.Home,
4242
CheckThat(() =>
4343
AssertScreenIs(1,
@@ -49,7 +49,14 @@ public void Render()
4949
TokenClassification.None, " ",
5050
TokenClassification.String, "\"hello ",
5151
TokenClassification.Variable, "$name",
52-
TokenClassification.String, "\"")),
52+
TokenClassification.String, "\"",
53+
TokenClassification.None, " ",
54+
TokenClassification.Number, "1",
55+
TokenClassification.None, " + (",
56+
TokenClassification.Number, "1",
57+
TokenClassification.Operator, "-",
58+
TokenClassification.Number, "2",
59+
TokenClassification.None, ")")),
5360
_.Ctrl_c,
5461
InputAcceptedNow
5562
));

0 commit comments

Comments
 (0)