bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#67604: Motion problems with inline images


From: JD Smith
Subject: bug#67604: Motion problems with inline images
Date: Mon, 4 Dec 2023 12:44:45 -0500


> On Dec 4, 2023, at 9:37 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> From: JD Smith <jdtsmith@gmail.com>
>> Date: Mon, 4 Dec 2023 09:25:16 -0500
>> Cc: 67604@debbugs.gnu.org
>> 
>> Strange.  Can I ask your (frame-char-width) and (frame-char-height)?  I 
>> haven’t yet found a font or size where the bug isn’t discoverable.  Usually 
>> at multiple frame widths.
> 
> width = 8, height = 16
> 
> I also tried 7 and 15, also without success.


Wonders never cease.  I just picked an 8x16 font and it worked fine, finding 
the bug at offset=2 (i.e. red svg=148 pixels wide). This was using the build 
from this morning with your recent xdisp.c fix.  To be sure we’re on the same 
page, I’ve included again the test code below.

My version info: GNU Emacs 30.0.50 (build 5, aarch64-apple-darwin23.1.0, NS 
appkit-2487.20 Version 14.1.2 (Build 23B92)) of 2023-12-04.   

I suppose this motion bug could be version-dependent?  If anyone else can 
confirm this on NS or other builds that would be most helpful.

One other scraping-the-barrel's-bottom idea: I’ve found before that 
(frame-char-width) when called “too early” yields incorrect/missing results; 
are you running the code interactively, or via a batch style setup?  Do you see 
a nice range of “Check with red image width …” messages?

++++
(require 'svg)
(let ((buf "svg-file-motion-demo")
      (ims '(("red" 146 29) ; 146 start
             ("green" 108 29) ; 108 start
             ("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))

(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"))))






reply via email to

[Prev in Thread] Current Thread [Next in Thread]