unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#42300: Visual bug in diff-mode
@ 2020-07-09 19:23 Gregory Heytings via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2020-08-13 16:23 ` Stefan Kangas
  0 siblings, 1 reply; 3+ messages in thread
From: Gregory Heytings via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2020-07-09 19:23 UTC (permalink / raw)
  To: 42300


Diff-mode was updated in Emacs 27, and it is now possible to use the 
fringe to indicate whether the lines were added, deleted, or are common. 
The face is omitted in the display property in the case common lines, 
which leads to the bug described below.

Steps to reproduce:

1. start emacs -Q
2. (setq diff-font-lock-prettify t)
3. to make the bug clearly visible: (set-face-attribute 'fringe nil :background "red" :foreground "yellow")
4. open a diff file (with "common" lines, that is, lines starting with a space)
5. observe that the fringe in front of the common lines is red
6. press C-x C-+, the fringe in front of the common lines is now white
7. press -, the fringe in front of the common lines is now red again

Fix:

--- diff-mode.el.orig	2020-06-29 17:39:26.000000000 +0000
+++ diff-mode.el	2020-07-09 18:44:08.000000000 +0000
@@ -2518,7 +2518,7 @@
                                 '((?+ . (left-fringe diff-fringe-add diff-indicator-added))
                                   (?- . (left-fringe diff-fringe-del diff-indicator-removed))
                                   (?! . (left-fringe diff-fringe-rep diff-indicator-changed))
-                                 (?\s . (left-fringe diff-fringe-nul))))))
+                                 (?\s . (left-fringe diff-fringe-nul fringe))))))
            (put-text-property (match-beginning 0) (match-end 0) 'display spec))))
      ;; Mimicks the output of Magit's diff.
      ;; FIXME: This has only been tested with Git's diff output.





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#42300: Visual bug in diff-mode
  2020-07-09 19:23 bug#42300: Visual bug in diff-mode Gregory Heytings via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2020-08-13 16:23 ` Stefan Kangas
  2020-08-14 15:33   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Kangas @ 2020-08-13 16:23 UTC (permalink / raw)
  To: Gregory Heytings; +Cc: 42300

tags 42300 + confirmed
found 42300 28.0.50
thanks

Gregory Heytings <ghe@sdf.org> writes:

> Diff-mode was updated in Emacs 27, and it is now possible to use the fringe to
> indicate whether the lines were added, deleted, or are common. The face is
> omitted in the display property in the case common lines, which leads to the bug
> described below.
>
> Steps to reproduce:
>
> 1. start emacs -Q
> 2. (setq diff-font-lock-prettify t)
> 3. to make the bug clearly visible: (set-face-attribute 'fringe nil :background "red" :foreground "yellow")
> 4. open a diff file (with "common" lines, that is, lines starting with a space)
> 5. observe that the fringe in front of the common lines is red
> 6. press C-x C-+, the fringe in front of the common lines is now white
> 7. press -, the fringe in front of the common lines is now red again

I can reproduce this on current master, and verify that the below change
fixes it.

I'm not that familiar with diff-mode.ela nor font-locking so it's better
that someone else takes a look and installs the fix.

> --- diff-mode.el.orig	2020-06-29 17:39:26.000000000 +0000
> +++ diff-mode.el	2020-07-09 18:44:08.000000000 +0000
> @@ -2518,7 +2518,7 @@
>                                 '((?+ . (left-fringe diff-fringe-add diff-indicator-added))
>                                   (?- . (left-fringe diff-fringe-del diff-indicator-removed))
>                                   (?! . (left-fringe diff-fringe-rep diff-indicator-changed))
> -                                 (?\s . (left-fringe diff-fringe-nul))))))
> +                                 (?\s . (left-fringe diff-fringe-nul fringe))))))
>            (put-text-property (match-beginning 0) (match-end 0) 'display spec))))
>      ;; Mimicks the output of Magit's diff.
>      ;; FIXME: This has only been tested with Git's diff output.

Best regards,
Stefan Kangas





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#42300: Visual bug in diff-mode
  2020-08-13 16:23 ` Stefan Kangas
@ 2020-08-14 15:33   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2020-08-14 15:33 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: Gregory Heytings, 42300

Stefan Kangas <stefan@marxist.se> writes:

> I can reproduce this on current master, and verify that the below change
> fixes it.
>
> I'm not that familiar with diff-mode.ela nor font-locking so it's better
> that someone else takes a look and installs the fix.

I'm not very familiar with that, either, but it seems "obviously
correct", if I understand that code correctly.  So I went ahead and
pushed it to Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-14 15:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-09 19:23 bug#42300: Visual bug in diff-mode Gregory Heytings via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-08-13 16:23 ` Stefan Kangas
2020-08-14 15:33   ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).