bug-gnu-emacs
[Top][All Lists]
Advanced

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

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


From: Juri Linkov
Subject: bug#61396: diff mode could distinguish changed from deleted lines
Date: Sat, 30 Sep 2023 20:38:22 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)

> 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





reply via email to

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