Open kahagerman opened 8 months ago
I came here to say exactly this.
diffr
has instantly become my favorite git diff tool, but I have a strong preference that completely added or removed lines be highlighted using (default colors version) foreground red and foreground green.
The use of background color to highlight the specific changes within changed lines is brilliant, but it's noisy when it gets applied to full lines as well.
I also think the default should be to highlight full added and removed lines "normally", but as long the tool is configurable to do that, I'm fully satisfied.
Regardless, it's a significant improvement on what I was using, so thanks for that!
I hope you don't mind an update: I've come to appreciate better how the color scheme works here, specifically that added
/removed
lines indicate a pure insertion or pure deletion, where the paired line highlights the modification in background color.
I do still think it would be useful/nice to be able to theme pure insertion and deletion separately, I would personally go with bold/bright green and red rather than background. But I no longer think the default should be to use the existing foreground colors for full insertions and deletions, now that I understand the logic better.
I'm not sure that the separate unchanged-added/removed
would be necessary given a pair of only-added
/only-removed
, though. As the original comment says, setting all four would mean that added
and removed
would only apply to the leading +
and -
, so that might be one theme too many.
My Use Case
(Since it's a bit hard to describe what I'm looking for without context.)
At a high level, I simply want my eyes to be naturally drawn to the relevant parts of modified lines.
When looking at a diff, I want changed lines to be highlighted green/red as usual.
However, for "modified" lines (i.e. lines which are not added or removed in full) I want to put more emphases on the specific parts of the line that have changed. Sort of "double-highlighting", first highlighted green/red because the line is added/removed, then highlighted even more because this part of the line is what actually changed.
However, I don't want this "double-highlighting" to apply to new or removed lines, only modified lines.
Currently Targetable
--color
Faces:Currently there are two main color pallets which can be customized:
added
/removed
, which applies to entire lines, andrefine-added
/refine-removed
, which applies to any added or removed text (within either a modified line or fully added/removed line).refined-added
andrefined-removed
are currently applied to completely added or completely removed lines.For my use case above, it's not currently possible to target changed sections within changed lines, without affecting purely added/removed lines.
Proposal
I suggest the following two targetable --color faces:
unchanged-added
andunchanged-removed
- for the parts of modified lines which are not changed, andonly-added
andonly-removed
- for lines which are added/removed in full.With these, it would be possible to separate full-line changes from changes withing lines, and color each individually.
And for purely backwards-compatibility reasons:
unchanged-added
/unchanged-removed
should inherit fromadded
/removed
, andonly-added
/only-removed
should inherit fromrefine-added
/refine-removed
.If all options were specified, then
added
/removed
would only apply to the+
/-
at the start of each line (and probably leading whitespace).(One more note: I've described everything above as added/removed vs changed lines, but it may be more appropriate to implement this on changed blocks instead.)
Thoughts?