From 948a8936ba26c7823f716bb1041ee3f309bb9ece Mon Sep 17 00:00:00 2001 From: Po Lu Date: Thu, 9 Dec 2021 17:57:25 +0800 Subject: [PATCH] Make precision scrolling up work over display strings * lisp/pixel-scroll.el (pixel-point-and-height-at-unseen-line): Use `window-text-pixel-size'. (pixel-scroll-precision-scroll-up-page): Use delta as vscroll directly. --- lisp/pixel-scroll.el | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/lisp/pixel-scroll.el b/lisp/pixel-scroll.el index 66aa480b708..ead841c9823 100644 --- a/lisp/pixel-scroll.el +++ b/lisp/pixel-scroll.el @@ -406,7 +406,9 @@ window, and the pixel height of that line." (if (bobp) (point-min) (vertical-motion -1) - (setq line-height (line-pixel-height)) + (setq line-height + (cdr (window-text-pixel-size nil (point) + pos0))) (point))))) ;; restore initial position (set-window-start nil pos0 t) @@ -530,21 +532,7 @@ the height of the current window." (goto-char (car position))) (setq delta (- delta (cdr position))))) (when (< delta 0) - (if-let* ((desired-pos (posn-at-x-y 0 (+ (- delta) - (window-tab-line-height) - (window-header-line-height)))) - (desired-start (posn-point desired-pos)) - (desired-vscroll (cdr (posn-object-x-y desired-pos)))) - (progn - (set-window-start nil (if (zerop (window-hscroll)) - desired-start - (save-excursion - (goto-char desired-start) - (beginning-of-visual-line) - (point))) - t) - (set-window-vscroll nil desired-vscroll t)) - (set-window-vscroll nil (abs delta) t))))))) + (set-window-vscroll nil (- delta) t)))))) (defun pixel-scroll-precision-interpolate (delta) "Interpolate a scroll of DELTA pixels. -- 2.39.2