[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Coloring Side-By-Side Changes

From: Dabrien 'Dabe' Murphy
Subject: [PATCH] Coloring Side-By-Side Changes
Date: Fri, 6 Jan 2023 20:07:15 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:52.0) Gecko/20100101 PostboxApp/7.0.59


I apologize if this isn't the best way to submit patches, but I've often wondered why `diff -y` only colored the (red) deletions and (green) insertions, when it's often the `| ` side-by-side changes I want to spot quickly...  Maybe it's already been discussed to death, and shot down numerous times, but I couldn't find any specific conversations in the archives after the initial flurry of activity back in 2015.

Anyway, these changes are pretty trivial and superficial -- and they don't seem to fail any existing regression tests -- though I freely admit I'm not particularly knowledgeable about the inner-workings of `diff`; it's wholly possible that I've missed any number of edge cases.  [I often say, "Nothing is easy; if it is, you're not thinking hard enough."]

I've broken it into two patches (attached), which can be applied in an either-or fashion to the current HEAD, depending on your desired level of customization:

- https://dabe.com/misc/diffutils--side-color.diff
-- This one simply re-uses the `ln` "Line Number" color palette / context, which, as far as I can tell, isn't displayed in side-by-side mode.

- https://dabe.com/misc/diffutils--side-color-yc.diff
-- This one adds a new `yc` "Side-By-Side Change" color palette / context, in case users want to customize it separately.  (Note: I just made up `yc`...  I didn't spend a LOT of time searching, but it didn't seem to be used in any, e.g., terminfo(5)-type documentation I could find.)

Thanks for your consideration,

:- Dabe

Attachment: diffutils--side-color.diff
Description: Text document

Attachment: diffutils--side-color-yc.diff
Description: Text document

reply via email to

[Prev in Thread] Current Thread [Next in Thread]