all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#66457: 30.0.50; shr sometimes displays the same image twice
@ 2023-10-11  0:25 Katsumi Yamaoka
  2023-10-11 12:04 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Katsumi Yamaoka @ 2023-10-11  0:25 UTC (permalink / raw)
  To: 66457

[-- 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

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

* bug#66457: 30.0.50; shr sometimes displays the same image twice
  2023-10-11  0:25 bug#66457: 30.0.50; shr sometimes displays the same image twice Katsumi Yamaoka
@ 2023-10-11 12:04 ` Eli Zaretskii
  2023-10-12  0:49   ` Katsumi Yamaoka
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2023-10-11 12:04 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: 66457

> Date: Wed, 11 Oct 2023 09:25:39 +0900
> From: Katsumi Yamaoka <yamaoka@jpl.org>
> 
> 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:

Thanks, but can you show a recipe to reproduce the issue and test the
solution?





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

* bug#66457: 30.0.50; shr sometimes displays the same image twice
  2023-10-11 12:04 ` Eli Zaretskii
@ 2023-10-12  0:49   ` Katsumi Yamaoka
  2023-10-12  5:08     ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Katsumi Yamaoka @ 2023-10-12  0:49 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 66457

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

On Wed, 11 Oct 2023 15:04:13 +0300, Eli Zaretskii wrote:
> Thanks, but can you show a recipe to reproduce the issue and test the
> solution?

Ok, here is an example html mail.
Set `mm-text-html-renderer' to `shr', read the example mail in
Gnus in some way, and try `W D W' and `W D D' commands.

[-- Attachment #2: Example --]
[-- Type: application/octet-stream, Size: 822 bytes --]

To: nobody
Subject: test
From: Katsumi Yamaoka <yamaoka@jpl.org>
Date: Thu, 12 Oct 2023 09:34:54 +0900
Message-ID: <dg9i8r881xw1.fsf@jpl.org>
MIME-Version: 1.0
Content-Type: multipart/related; boundary="===boundary==="; type="text/html"; start="<start>"

--===boundary===
Content-Type: text/html
Content-ID: <start>

<html>
  <body>
    Here should be a single box:
    <img src="cid:image"
	 alt="**** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** ">
  </body>
</html>

--===boundary===
Content-Transfer-Encoding: base64
Content-Disposition: inline
Content-Type: image/png
Content-ID: <image>

iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAAA1BMVEUA//8ZXC8lAAAADUlEQVQY
02NgGAXUBAABUAABp+LaFgAAAABJRU5ErkJggg==

--===boundary===--

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

* bug#66457: 30.0.50; shr sometimes displays the same image twice
  2023-10-12  0:49   ` Katsumi Yamaoka
@ 2023-10-12  5:08     ` Eli Zaretskii
  2023-10-25 13:47       ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2023-10-12  5:08 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: 66457

> Date: Thu, 12 Oct 2023 09:49:00 +0900
> From: Katsumi Yamaoka <yamaoka@jpl.org>
> Cc: 66457@debbugs.gnu.org
> 
> On Wed, 11 Oct 2023 15:04:13 +0300, Eli Zaretskii wrote:
> > Thanks, but can you show a recipe to reproduce the issue and test the
> > solution?
> 
> Ok, here is an example html mail.
> Set `mm-text-html-renderer' to `shr', read the example mail in
> Gnus in some way, and try `W D W' and `W D D' commands.

Thanks.  (That was an invalid mbox file, btw; I needed to fix it, but
that was easy.  Also, I don't use Gnus, so if you can show a fill
recipe including the "read the example mail in Gnus in some way" part,
I'd appreciate that, as I'd like to make sure I see exactly what you
see in Gnus.  Meanwhile, I tried in Rmail instead, which also uses
shr.el to display HTML emails.)

So now I'm not sure I understand what you are saying.  You said:

> 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).

AFAIU, the alt text is text that is displayed instead of an image,
when the image cannot or should not be displayed for some reason.  If
my understanding is correct, then why do you expect the alt text to
take only one line on display?





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

* bug#66457: 30.0.50; shr sometimes displays the same image twice
  2023-10-12  5:08     ` Eli Zaretskii
@ 2023-10-25 13:47       ` Eli Zaretskii
  2023-10-25 23:58         ` Katsumi Yamaoka
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2023-10-25 13:47 UTC (permalink / raw)
  To: yamaoka; +Cc: 66457

Ping!

> Cc: 66457@debbugs.gnu.org
> Date: Thu, 12 Oct 2023 08:08:57 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> 
> > Date: Thu, 12 Oct 2023 09:49:00 +0900
> > From: Katsumi Yamaoka <yamaoka@jpl.org>
> > Cc: 66457@debbugs.gnu.org
> > 
> > On Wed, 11 Oct 2023 15:04:13 +0300, Eli Zaretskii wrote:
> > > Thanks, but can you show a recipe to reproduce the issue and test the
> > > solution?
> > 
> > Ok, here is an example html mail.
> > Set `mm-text-html-renderer' to `shr', read the example mail in
> > Gnus in some way, and try `W D W' and `W D D' commands.
> 
> Thanks.  (That was an invalid mbox file, btw; I needed to fix it, but
> that was easy.  Also, I don't use Gnus, so if you can show a fill
> recipe including the "read the example mail in Gnus in some way" part,
> I'd appreciate that, as I'd like to make sure I see exactly what you
> see in Gnus.  Meanwhile, I tried in Rmail instead, which also uses
> shr.el to display HTML emails.)
> 
> So now I'm not sure I understand what you are saying.  You said:
> 
> > 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).
> 
> AFAIU, the alt text is text that is displayed instead of an image,
> when the image cannot or should not be displayed for some reason.  If
> my understanding is correct, then why do you expect the alt text to
> take only one line on display?
> 
> 
> 
> 





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

* bug#66457: 30.0.50; shr sometimes displays the same image twice
  2023-10-25 13:47       ` Eli Zaretskii
@ 2023-10-25 23:58         ` Katsumi Yamaoka
  0 siblings, 0 replies; 6+ messages in thread
From: Katsumi Yamaoka @ 2023-10-25 23:58 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 66457

On Wed, 25 Oct 2023 16:47:12 +0300, Eli Zaretskii wrote:
> Ping!

[...]

>>> 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).

>> AFAIU, the alt text is text that is displayed instead of an image,
>> when the image cannot or should not be displayed for some reason.  If
>> my understanding is correct, then why do you expect the alt text to
>> take only one line on display?

Well, I don't think so, i.e., the alt text may be multiple lines.
However, the author wrote shr-fill-line so to assume it to take
a single line, or he only might have overlooked it.





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

end of thread, other threads:[~2023-10-25 23:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-11  0:25 bug#66457: 30.0.50; shr sometimes displays the same image twice Katsumi Yamaoka
2023-10-11 12:04 ` 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

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.