From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#61396: diff mode could distinguish changed from deleted lines Date: Mon, 04 Sep 2023 17:06:06 -0400 Message-ID: References: Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9480"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 61396@debbugs.gnu.org To: Samuel Wales Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Sep 04 23:07:17 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 1qdGmy-0002Fx-W7 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 04 Sep 2023 23:07:17 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qdGmm-0007vU-Jl; Mon, 04 Sep 2023 17:07:04 -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 1qdGmk-0007v1-M0 for bug-gnu-emacs@gnu.org; Mon, 04 Sep 2023 17:07:02 -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 1qdGmk-0007ts-DW for bug-gnu-emacs@gnu.org; Mon, 04 Sep 2023 17:07:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qdGmj-00008V-Pz for bug-gnu-emacs@gnu.org; Mon, 04 Sep 2023 17:07:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 04 Sep 2023 21:07:01 +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.1693861580464 (code B ref 61396); Mon, 04 Sep 2023 21:07:01 +0000 Original-Received: (at 61396) by debbugs.gnu.org; 4 Sep 2023 21:06:20 +0000 Original-Received: from localhost ([127.0.0.1]:52781 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qdGm4-00007P-Cr for submit@debbugs.gnu.org; Mon, 04 Sep 2023 17:06:20 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:54241) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qdGly-000073-Mb for 61396@debbugs.gnu.org; Mon, 04 Sep 2023 17:06:19 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id E053610006B; Mon, 4 Sep 2023 17:06:08 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1693861567; bh=FC7GVXr0zMc3OSSyYna+OtN2/j+CfuKZxcfP3SGWiEk=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=QDkijb9fJQu9EMfN54upVuOFhoeVlyazGvfvs5wRzg3pV6ZRwoSEae1EYoj01xGCM WWdS9KomZ8eClm8jRIqJ108lnkcU1j6uqFrTYxmrwlzTo8RBQ2kqvNrkl7VK+eEl+h KNEIWea+VvH9XcZT+TfJOmUx8yjr9gYcof5I6HVQfsA5SlVjf6NT9AtpjEzVlkpO71 eE5+SbUKvUO+CTWM0+fd1HT1v2orWOW5l3fDVkzNfLvYhqLUWVBUJOKdfcpf69VkIH vBX3M9ckvNG56M3ipUodfpMStPkOiKxpzkakzW4HkWKY9eIHUJmqen+uMcHoy52J0J dsfAYlQlEEeFw== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id BC9CE100046; Mon, 4 Sep 2023 17:06:07 -0400 (EDT) Original-Received: from pastel (69-165-136-223.dsl.teksavvy.com [69.165.136.223]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 9968612032C; Mon, 4 Sep 2023 17:06:07 -0400 (EDT) In-Reply-To: (Samuel Wales's message of "Thu, 9 Feb 2023 20:25:25 -0700") 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:269305 Archived-At: > 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: It took me a bit of re-reading and thinking to form an opinion, but IIUC there are 2 distinct issues at play: - First, `diff -u` (contrary to `diff -c`) does not distinguish between `removed/added` and `modified` lines. And `diff-mode` currently inherits this weakness. I think there's a good case to be made for highlighting the "truly added" and "truly removed" lines differently from those that are modified. I'd argue that a "logical" choice would be to highlight them the same way as those parts highlighted by `diff-refine-hunk` (i.e. `diff-refine-removed` and `diff-refine-added`) since that's how refinement would highlight them if we were to ask it to. - Second, `diff-refine-hunk` highlights the text actually added and the text actually removed within modified lines, but not the place where text is added/removed in the other version. [ As pointed out by Juri (thanks for Cc'ing me, BTW) this is linked to a comment I left in `smerge--refine-highlight-change`, tho that comment was thinking of a slightly different feature (namely the ability to jump from one version to the other, or the addition of a "phantom" cursor highlighting the corresponding place in the other version). ] Here the problem is mostly that we don't have a standard way to highlight a "place" (which is something that occupies 0 pixels on screen). But we could follow the (not unanimously appreciated) lead of `rectangle-mode` and insert a thin (highlighted) visual space to mark those places. That should be not too hard to do, but it would have to be optional I think because it'd tend to break alignment, so some people may not find the upside significant enough to justify the downsides. -- Stefan