Subject: Re: bug#61396: diff mode could distinguish changed from deleted lines

From: Juri Linkov <[email-masked]>
Date: Sat, 30 Sep 2023 20:38:22 +0300

> I have been bitten several times in the past when going through largish
> diffs where I overlooked important things in the added/removed parts
> because they were colored the same was as the unchanged parts of
> changed lines and so I just glossed over them.

I realized now the same problem exists even without color highlighting at all.
This is because of a poor choice of indicators in the diff utility.

When hunk boundaries are off-screen, there is no way to distinguish
whether a unified format hunk contains added or changed lines:

  @@
  + added line 1
  + added line 2

vs

  ---
  + changed line 1
  + changed line 2

The context format is slightly better, but still the indicator !
is ambiguous and can't distinguish between old and new changed lines:

  ! old changed line 1
  ! old changed line 2
  ---
  ! new changed line 1
  ! new changed line 2

Only the normal format can do this unambiguously with < and >.

So the perfect format would be like unified but using < and >
for the changed lines:

  @@
  + added line 1
  + added line 2
  @@
  < old changed line 1
  < old changed line 2
  ---
  > new changed line 1
  > new changed line 2
  @@
  - removed line 1
  - removed line 2