Last active
December 6, 2023 18:16
-
-
Save jdtsmith/914c9f44ed5f5394e4ec188b00b09b47 to your computer and use it in GitHub Desktop.
bug67604
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Simple test exhibiting motion errors with inline images. | |
;; See Bug#67604 | |
;; 1. Eval this buffer (M-x eval-buffer). | |
;; 2. A buffer with 3 colored SVG blocks will appear. | |
;; 3. Adjust your frame's width until the green image just wraps to | |
;; the 2nd screen line, then reduce width by one more char. | |
;; 4. In the buffer with the images, M-x my/find-skip-bug. If it | |
;; succeeds, it will report the pixel offset where the bug | |
;; occurred. NOTE: The Green image must appear at the start of a | |
;; line, or a "false positive" bug ID has occurred. Increase your | |
;; frame width one char and try again. | |
;; 5. Goto (point-min). You'll notice that 2 next-line's put you on | |
;; screen line 4: JUMPS HERE. | |
(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")))), | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a video of the bug being discovered on a Linux system with master. First, the test code above is eval'd in the
*scratch*
buffer, then various frame-widths are tried until a real version of the bug is found.Screen.Recording.2023-12-06.at.1.10.56.PM.mov