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

From: Samuel Wales <[email-masked]>
Date: Wed, 8 Mar 2023 14:14:50 -0700

this problem is highly noticeable for me.

i am thinking just a thin vertical bar for removed text would be
possible and work well.

there is something i do that makes the problem even more noticeable.
imagine you want to improve the diff for human consumption as follows.
you keep the top --- +++ and first @@ lines.  then you group by
polarity.  what i mean by group by polarity is, you sort by - or + but
not by anything else.  that is, you put all - lines before + lines,
but you do not change the sequence of lines within - or +.  this might
sound strange but it makes for much better understandability in many
cases.

glitches that show up in normal diff-mode are often removed.  it is a
highly useful diff viewing experience, but of course is useless for
patches and so on.

doing this takes all the diff hunks and smushes them together.
deliberately.  you can look at - and know whether you have deleted
anything.  but because of this bug, you don't know whether it is a
true deletion, or whether you added something to the line in + unless
you also look at +.  this is in principle fixable.

however, you do not need to do this to notice the problem.  a big hunk
will have this problem also in many cases.

On 2/9/23, Samuel Wales <[email-masked]> wrote:
> in diff mode, with diff -u, if a line in A was added to
> in B, you can't tell by looking at the A version whether it was
> =deleted= in B or =changed= from A to B.  you have to
> manually find it in B and then compare.  here is an example:
>
>   -now is the time
>   +now is the time FOR ALL GOOD MEN
>
> the - line is in del face.  there is no indication on that
> line that the line is not deleted.
>
> if the lines are separated sufficiently, it is not obvious
> to the user whether it is a line that was deleted, or, as
> above, added to.  the del face is therefore ambiguous and can be
> potentially misleading to the user.
>
> ===
>
> the only thing that tells you non-confusingly that A was
> changed, or where, is if you look at B.
>
> this is not practical when there are many lines.
>
> a fix is to have a different face for changed lines.  i
> suggest a muted bg face.  another fix is to stick a colored
> marker INDICATOR in A where changes in B exist.
>
>   -now is the time^
>   +now is the time FOR ALL GOOD MEN
>
> where ^ is a colored marker -- actually just a changed bg
> for the newline in this case would work, but i don't think
> emacs supports that.
>
> thank you.
>
> --
> The Kafka Pandemic
>
> A blog about science, health, human rights, and misopathy:
> https://thekafkapandemic.blogspot.com
>

-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com