fix!: View colors in git-blob diff files #11930
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed changes
This PR is to simplify troubleshooting, not really something that normal users will have benefit from.
GE currently tries to apply coloring with the "GE color engine"
for all files that ends with .diff or .patch.
This PR expands on this heuristics by trying to present colors in
files where the Git color engine has stored the colors as ANSI
terminal sequence.
If a file to present seem to be a diff file get the file with escape
sequences and present with the ansi terminal colors if they exist.
For other diff files, use the GE color engine.
Include tests/app/UnitTests/GitUI.Tests/Editor/Diff/AnsiTerminalColors.diff
to view terminal colors.
Also include a file to present the presentation of ansi terminal
colors.
tests/app/UnitTests/GitUI.Tests/Editor/Diff/diff_added_moved.diff
tests/app/UnitTests/GitUI.Tests/Editor/Diff/diff_removed_moved.diff
will also be used in follow ups
Note that all sample diff files are not displayed as they would be if Git
displays them
tests/app/UnitTests/GitUI.Tests/Editor/Diff/SampleCombined.diff
Not stored with colors
The output is not changed
tests/app/UnitTests/GitUI.Tests/Editor/Diff/SampleCombined.diff
Not stored that this is a combined diff, so line numbers are not detected.
tests/app/UnitTests/GitUI.Tests/Editor/Diff/SampleDifftastic.diff
Not stored that this is a difftastic file, so the GE adjustments are not done.
fix: presentation tweak of command cache commands
command
Easier to copy the commands when viewing/debugging cache.
Screenshots
Syntax highlighting is deactivated to not distract
After includes #11851/#11862
Test methodology
Manual - for debugging
Merge strategy
I agree that the maintainer squash merge this PR (if the commit message is clear).
(Could be rebase merged too, but the first commit is very minor.)
✒️ I contribute this code under The Developer Certificate of Origin.