unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Katsumi Yamaoka <yamaoka@jpl.org>
To: 66457@debbugs.gnu.org
Subject: bug#66457: 30.0.50; shr sometimes displays the same image twice
Date: Wed, 11 Oct 2023 09:25:39 +0900	[thread overview]
Message-ID: <b4mv8bedmyk.fsf@jpl.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 273 bytes --]

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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1045 bytes --]

--- 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	other threads:[~2023-10-11  0:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-11  0:25 Katsumi Yamaoka [this message]
2023-10-11 12:04 ` bug#66457: 30.0.50; shr sometimes displays the same image twice Eli Zaretskii
2023-10-12  0:49   ` Katsumi Yamaoka
2023-10-12  5:08     ` Eli Zaretskii
2023-10-25 13:47       ` Eli Zaretskii
2023-10-25 23:58         ` Katsumi Yamaoka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b4mv8bedmyk.fsf@jpl.org \
    --to=yamaoka@jpl.org \
    --cc=66457@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).