On Dec 3, 2023, at 12:11 PM, Eli Zaretskii <eliz@gnu.org> wrote:

From: JD Smith <jdtsmith@gmail.com>
Date: Sun, 3 Dec 2023 11:54:27 -0500

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

I tried different frame widths, but couldn't reproduce the problem.
Not with the latest master branch, anyway, where I recently installed
the changes from bug#67533.

If someone can tell what frame width and default font height trigger
the problem, I will try to reproduce with those sizes.

I just compiled a fresh NS build from master with your bug#67533 fix.  It triggers the skip-a-line bug for me, from emacs -q at frame-width=79.  But I can also confirm, it is font size dependent, likely occurring with only a precise combination of pixel sizes.  

Here’s an easy way to find it with your font, using the attached command:

  • Run the let-form mentioned in my initial message.
  • Resize the frame width down until the green image first moves to the beginning of a visual line (80 chars, for me).
  • Resize down one more column *without causing further wrap* (79 chars for me).
  • In the svg-file-motion-demo buffer, execute M-x my/find-skip-bug.
  • It should report the pixel width needed for the red SVG image on the first line to trigger the bug, and leave the demo buffer in that state.
  • Hitting down twice from (point-min) should land on JUMPS HERE, bypassing the stub line “pulvinar nibh".

++++

(defun my/find-skip-bug ()
  (interactive)
  (goto-char (point-min))
  (let* ((ov (car (overlays-at 10)))
(w 146)
(h 29)
(wc (frame-char-width))
(res
 (cl-loop
  for off from (- (- wc 2)) to (1- wc)
  for sw = (+ w off)
  for svg = (svg-create sw h) do
  (message "Checking with red image width %d" sw)
  (svg-rectangle svg 0 0 sw h :fill-color "red")
  (overlay-put ov 'display (svg-image svg :ascent 'center))
  if (save-excursion
(next-line) (next-line)
(beginning-of-visual-line)
(looking-at "JUMPS HERE"))
  return off
  finally return nil)))
    (if res (message "Found Bug at offset %d = %d pixels" res (+ w res))
      (message "Did not find Bug"))))