]> git.eshelyaron.com Git - emacs.git/commitdiff
Make precision scrolling up work over display strings
authorPo Lu <luangruo@yahoo.com>
Thu, 9 Dec 2021 09:57:25 +0000 (17:57 +0800)
committerPo Lu <luangruo@yahoo.com>
Thu, 9 Dec 2021 09:57:25 +0000 (17:57 +0800)
* 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

index 66aa480b70853c442acb0861abc06ed3c4184b87..ead841c9823b156b32a942eb69d3639811b78723 100644 (file)
@@ -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.