bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#66457: 30.0.50; shr sometimes displays the same image twice


From: Katsumi Yamaoka
Subject: bug#66457: 30.0.50; shr sometimes displays the same image twice
Date: Wed, 11 Oct 2023 09:25:39 +0900

Hi,

If an alt text, that has an `image-displayer' text property, is
filled by `shr-fill-line' by way of `shr-fill-lines', the image
is displayed for two or more times.  It is because the
`image-displayer' text property is divided by the newline(s).
Here is a quick hack:

--- lisp/net/shr.el~    2023-09-04 23:25:12.472173300 +0000
+++ lisp/net/shr.el     2023-10-11 00:23:43.577152000 +0000
@@ -799,13 +799,17 @@
         (when (= (preceding-char) ?\s)
          (delete-char -1))
         (let ((gap-start (point))
-              (face (get-text-property (point) 'face)))
-          ;; Extend the background to the end of the line.
+              (face (get-text-property (point) 'face))
+              (displayer (get-text-property (point) 'image-displayer)))
+          ;; Extend the background and the image displayer to the end
+          ;; of the line.
           (insert ?\n)
          (shr-indent)
           (when face
             (put-text-property gap-start (point)
                                'face (shr-face-background face)))
+          (when displayer
+            (put-text-property gap-start (point) 'image-displayer displayer))
           (when (and (> (1- gap-start) (point-min))
                      (get-text-property (point) 'shr-url)
                      ;; The link on both sides of the newline are the

reply via email to

[Prev in Thread] Current Thread [Next in Thread]