-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Diff moved lines: Use dimmed-zebra algorithm #11721
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
Diff moved lines: Use dimmed-zebra algorithm #11721
Conversation
I agree that the colors from undimmed zebra are very / too bright for GE. |
Colors are are selected from a bright theme with weighted values:
The "slots" that can be configured: dimmed-zebra applies faint/dim to first section and dim-italics to alternative. They will therefore look the same (similar in mintty when I test). I do not know if the intention in Git is to have default color dim (and possibly italic). In all cases the color is reset so magenta etc is not applied. One alternative is to override the bold colors for moved in zebra (and bold in range-diff) from bold to normal (or maybe dim). Will update the PR, change the title. |
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.
Thank you
Dimmed-colors put emphasis on the border between changes. Override diff moved colors Default (zebra) use bold colors that are too bright, dimmed-zebra by default only gray. Usea combination with dimmed colors for moved lines and normal colors for border changes. Bold/bright changed to normal also for range-diff
75f9ea6
to
1fd0715
Compare
Dimmed-colors put emphasis on the border between changes. Override diff moved colors Default (zebra) use bold colors that are too bright, dimmed-zebra by default only gray. Usea combination with dimmed colors for moved lines and normal colors for border changes. Bold/bright changed to normal also for range-diff
1fd0715
to
b4e5758
Compare
I made the range-diff specific not being printed, the command is long enough as it is (not important to optimize for range-diff). |
Tweak to #11674
Proposed changes
git-diff detects moved blocks (with at least 20 chars) and colors adjacent blocks with alternate colors.
The alternative color profile will use dimmed colors for lines that are moved without changes so changed lines stand out better.
Border lines close to changes are marked (not always done by Git though...)
A better description: https://stackoverflow.com/questions/57817642/whats-the-purpose-of-dimmed-zebra
This PR changes to use dimmed-zebra instead (zebra is git default).
A bonus is that the GE colors are hard to see in the terminal. (such theme colors are hard to tune)
After feedback, colors are changed to be dimmed colors for moved and normal colors (but not reverse video) for border lines.
Need to be updated in the GE doc PR too.
Screenshots
Before
block1 and block2 should have alternate colors
After
Not sure why block2 added do not have alternate colors
Slight update with some alternate blocks where border is seen
Test methodology
manual
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.