GNU bug report logs - #67604
Motion problems with inline images

Previous Next

Package: emacs;

Reported by: JD Smith <jdtsmith <at> gmail.com>

Date: Sun, 3 Dec 2023 16:56:01 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: JD Smith <jdtsmith <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Motion problems with inline images
Date: Sun, 3 Dec 2023 11:54:27 -0500
[Message part 1 (text/plain, inline)]
Following on from the recently fixed bug#67533, which related to incorrect pixel size measurements with inline images, one remaining issue, with that fix in place, relates to motion in buffers in visual line mode with inline images.  A video of the effect <https://gist.github.com/jdtsmith/ad765047a6afe20f353de573d8c07da9?permalink_comment_id=4780726#gistcomment-4780726> can be seen on the associated gist for bug#67533.

Here the issue is that next-line/forward-line/(vertical-motion 1) all skip from the Green inline SVG straight to the “JUMPS HERE” line, for certain frame widths (for me: 79 characters).  See reproduction code, below.  Depending on your font char size (mine is 7x14 pixels) this width may vary for you.  Note that multiple frame width produce the exact same wrapped appearance, but the motion bug shows up only for one of them.

There are other related phenomena, such as prev-line from an image at column 0 jumping to (near the) end of the previous screen line, but hopefully this is enough to identify the motion issue(s) at hand.

++++ 
(require 'svg)
(let ((buf "svg-file-motion-demo")
      (ims '(("red" 146 29)
	     ("green" 106 29)
	     ("blue" 151 29))))
  (with-current-buffer (get-buffer-create buf)
    (erase-buffer)
    (visual-line-mode 1)
    (insert "tellus.  $\\gamma(t) = \\log\\left(\\sqrt{\\tan(t)}\\right)$  Donec hendrerit tempor tellus.  $\\chi(y) = \\sqrt{\\frac{1}{\\log(y)}}$  Phasellus lacus.  $\\tau(t) = \\exp\\left(\\sqrt{\\exp(t)}\\right)$  Curabitur lacinia pulvinar nibh.
JUMPS HERE")
    (goto-char (point-min))
    (while  (re-search-forward (rx ?$ (* (not ?$)) ?$) nil t)
      (let* ((ov (make-overlay (match-beginning 0) (match-end 0)))
	     (im (pop ims))
	     (svg (svg-create (nth 1 im) (nth 2 im))))
	(svg-rectangle svg 0 0 (nth 1 im) (nth 2 im) :fill-color (car im))
	(overlay-put ov 'display (svg-image svg :ascent 'center)))))
  (pop-to-buffer buf))
++++

[Message part 2 (text/html, inline)]

This bug report was last modified 10 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.