Skip to content

Conversation

gerhardol
Copy link
Member

Proposed changes

Related to #11847

The handling of ANSI escape sequences was probably not completely correct (there is no clear spec...).
All direct attributes applies to all colors specified.

So git colors "black bold red" and "black bold red" are translated to the sequence "1, 30, 41" which will render the same as "brightblack brightred" ("90, 101"), but "black brightred" ("30, 101") is different.
Attributes should not be "persistent" if a "bright" color is set explicitly.

The implementation is slightly simplified too.

In reality, the implementation would not be a major issue as attributes are not often used in combination like this.

Test methodology

Tests are mostly unchanged.

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.

Copy link
Member

@mstv mstv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks sensible

@gerhardol
Copy link
Member Author

gerhardol commented Aug 25, 2024

An alternative to use AnsiEscapeUtilities.cs:PrintColors() in GitExtensions is to clone the following repo and view the following file as a diff.
I considered adding the file to GE repo, but there are some quirks like you have to view this as a diff to see the colors. There are some handling of .diff/patch in FileTree, but parsing escape sequences are not enabled (I no not want to do that especially for this: Hardcode filename?)

https://github.com/gerhardol/tmp_tests/blob/feature/ansi-color-template/AnsiTerminalColors.diff

I would like to include this in 5.0 release.

@gerhardol gerhardol merged commit 211eaf1 into gitextensions:master Aug 25, 2024
3 of 4 checks passed
@gerhardol gerhardol deleted the feature/ansi-bold-attribute branch August 25, 2024 18:32
@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