From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#61396: diff mode could distinguish changed from deleted lines Date: Sat, 30 Sep 2023 20:38:22 +0300 Organization: LINKOV.NET Message-ID: <86r0mf1rzl.fsf@mail.linkov.net> References: <85f73356-3a11-c76c-dd9a-f2dc1f6ef504@gutov.dev> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38094"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) Cc: Dmitry Gutov , 61396@debbugs.gnu.org, Samuel Wales To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Sep 30 19:50:23 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qme6g-0009eW-Q5 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 30 Sep 2023 19:50:22 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qme67-0006wb-Vo; Sat, 30 Sep 2023 13:49:47 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qme67-0006wK-8c for bug-gnu-emacs@gnu.org; Sat, 30 Sep 2023 13:49:47 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qme66-00049F-QY for bug-gnu-emacs@gnu.org; Sat, 30 Sep 2023 13:49:47 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qme6M-0005L5-9A for bug-gnu-emacs@gnu.org; Sat, 30 Sep 2023 13:50:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 30 Sep 2023 17:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61396 X-GNU-PR-Package: emacs Original-Received: via spool by 61396-submit@debbugs.gnu.org id=B61396.169609614620433 (code B ref 61396); Sat, 30 Sep 2023 17:50:02 +0000 Original-Received: (at 61396) by debbugs.gnu.org; 30 Sep 2023 17:49:06 +0000 Original-Received: from localhost ([127.0.0.1]:59719 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qme5Q-0005JQ-BC for submit@debbugs.gnu.org; Sat, 30 Sep 2023 13:49:05 -0400 Original-Received: from relay1-d.mail.gandi.net ([217.70.183.193]:60767) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qme5K-0005I1-8l for 61396@debbugs.gnu.org; Sat, 30 Sep 2023 13:49:02 -0400 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id AECBB240003; Sat, 30 Sep 2023 17:48:33 +0000 (UTC) In-Reply-To: (Stefan Monnier via's message of "Wed, 13 Sep 2023 10:51:54 -0400") X-GND-Sasl: juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:271556 Archived-At: > 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