]> git.eshelyaron.com Git - emacs.git/commit
Fix zooming images in SHR
authorJim Porter <jporterbugs@gmail.com>
Thu, 20 Jun 2024 03:59:59 +0000 (20:59 -0700)
committerEshel Yaron <me@eshelyaron.com>
Mon, 24 Jun 2024 07:06:54 +0000 (09:06 +0200)
commit0b10c67e85777260c7b375991a99be05c4c9c9f6
treea41ff40493557cae68435475ab1f260dbff34426
parent8c7402168cee3af6c6ee91eac2c5f3cf09b5a506
Fix zooming images in SHR

Previously, for images with no alt-text, the zoomed image wouldn't get
properly inserted.  For images with alt-text, both the zoomed and
unzoomed image would be displayed at once (bug#71666).

* lisp/net/shr.el (shr-sliced-image): New face.
(shr-zoom-image): Reimplement using
'next/previous-single-property-change', and don't bother deleting any of
the text.
(shr-image-fetched): Clean up any overlays when deleting the old region.
(shr-put-image): Ensure we always have a non-empty string to put the
image on.  For sliced images, just use "*", since we'll repeat it, so we
can't preserve the original buffer text exactly anyway.  Apply an
overlay to sliced images to prevent unsightly text decorations.
(shr-tag-img): Move the placeholder space insertion where it should be
and explain what it's doing.

* test/lisp/net/shr-tests.el (shr-test--max-wait-time)
(shr-test-wait-for): New helper functions.
(shr-test/zoom-image): New test.

(cherry picked from commit 5f9b5803bea0f360a91e00cd85d72ea7f56d6095)
lisp/net/shr.el
test/lisp/net/shr-tests.el