1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-28 07:45:00 +00:00

Fix horizontal scrolling of images with C-f

* lisp/image-mode.el (image-forward-hscroll): Calculate the
window-width more accurately, as the number of full columns that
fits in the window's text-area.  (Bug#65187)
This commit is contained in:
Eli Zaretskii 2023-08-16 20:42:16 +03:00
parent 8cf5659ec2
commit 7856d51436

View File

@ -248,8 +248,9 @@ Stop if the right edge of the image is reached."
(image-set-window-hscroll (max 0 (+ (window-hscroll) n))))
(t
(let* ((image (image-get-display-property))
(edges (window-inside-edges))
(win-width (- (nth 2 edges) (nth 0 edges)))
(edges (window-edges nil t nil t))
(win-width (- (/ (nth 2 edges) (frame-char-width))
(/ (nth 0 edges) (frame-char-width))))
(img-width (ceiling (car (image-display-size image)))))
(image-set-window-hscroll (min (max 0 (- img-width win-width))
(+ n (window-hscroll))))))))