emacs-diffs
[Top][All Lists]
Advanced

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

master 948a893: Make precision scrolling up work over display strings


From: Po Lu
Subject: master 948a893: Make precision scrolling up work over display strings
Date: Thu, 9 Dec 2021 04:58:25 -0500 (EST)

branch: master
commit 948a8936ba26c7823f716bb1041ee3f309bb9ece
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    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 66aa480..ead841c 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.



reply via email to

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