Skip to content

Conversation

gerhardol
Copy link
Member

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.

  • 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.

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.

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.
Comment on lines +191 to +219
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]);
Copy link
Member

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?

Copy link
Member Author

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.

@gerhardol gerhardol merged commit f31efc2 into gitextensions:master Sep 18, 2024
3 of 4 checks passed
@gerhardol gerhardol deleted the feature/newline-textmarkers branch September 18, 2024 19:12
@RussKie RussKie added this to the 5.1 milestone Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants