GNU bug report logs - #61396
diff mode could distinguish changed from deleted lines

Previous Next

Package: emacs;

Reported by: Samuel Wales <samologist <at> gmail.com>

Date: Fri, 10 Feb 2023 03:26:01 UTC

Severity: normal

Full log


Message #128 received at 61396 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Dmitry Gutov <dmitry <at> gutov.dev>, 61396 <at> debbugs.gnu.org,
 Samuel Wales <samologist <at> gmail.com>
Subject: Re: bug#61396: diff mode could distinguish changed from deleted lines
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




This bug report was last modified 1 year and 318 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.