-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
fix: Merge git-diff textmarkers separated by newlines #11921
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Merge git-diff textmarkers separated by newlines #11921
Conversation
Number of text markers affect performance, merge with previous text marker if the new is directly following or only separated by newline. * do not color empty \r git-diff tries to color \r also if diff.colorMovedWS=no This has no visible effect and is just polluting the markers.
textMarkers[0].Offset.Should().Be(10); | ||
textMarkers[0].Length.Should().Be(23); | ||
textMarkers[0].Color.Should().Be(SystemColors.Window); | ||
textMarkers[0].ForeColor.Should().Be(Color.FromArgb(255, 255, 0, 0)); | ||
|
||
textMarkers[1].Offset.Should().Be(62); | ||
textMarkers[1].Length.Should().Be(1); | ||
textMarkers[1].Color.Should().Be(SystemColors.Window); | ||
textMarkers[1].ForeColor.Should().Be(_redAnsiTheme[0]); | ||
|
||
textMarkers[2].Offset.Should().Be(63); | ||
textMarkers[2].Length.Should().Be(38); | ||
textMarkers[2].Color.Should().Be(SystemColors.Window); | ||
textMarkers[2].ForeColor.Should().Be(_redAnsiTheme[2]); | ||
|
||
textMarkers[3].Offset.Should().Be(102); | ||
textMarkers[3].Length.Should().Be(14); | ||
textMarkers[3].Color.Should().Be(SystemColors.Window); | ||
textMarkers[3].ForeColor.Should().Be(_redAnsiTheme[1]); | ||
|
||
textMarkers[4].Offset.Should().Be(116); | ||
textMarkers[4].Length.Should().Be(47); | ||
textMarkers[4].Color.Should().Be(SystemColors.Window); | ||
textMarkers[4].ForeColor.Should().Be(_redAnsiTheme[2]); | ||
|
||
textMarkers[5].Offset.Should().Be(164); | ||
textMarkers[5].Length.Should().Be(54); | ||
textMarkers[5].Color.Should().Be(SystemColors.Window); | ||
textMarkers[5].ForeColor.Should().Be(_redAnsiTheme[0]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could all of these be verified with a single snapshot? That is, use Verify?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of themes makes this difficult. Values need to be hardcoded in the theme.
(I have considered this as it tedious to make changes to the tests...)
Maybe later.
Follow up to #11887
Adds tests, refactor a little, slightly more performant and merges some more text markers.
This was discussed with #11843 but is not strictly needed (but simplifies that PR too).
Proposed changes
Number of text markers affect performance, merge with previous text marker if the new is directly following or only separated by newline.
git-diff tries to color \r also if diff.colorMovedWS=no This has no visible effect and is just polluting the markers.
Screenshots
No change, \r\n are never colored.
Test methodology
Tests are added.
Merge strategy
I agree that the maintainer squash merge this PR (if the commit message is clear).
✒️ I contribute this code under The Developer Certificate of Origin.