]> git.eshelyaron.com Git - emacs.git/commitdiff
Make pixel scrolling through images at the first line smoother
authorPo Lu <luangruo@yahoo.com>
Fri, 26 Nov 2021 05:21:48 +0000 (13:21 +0800)
committerPo Lu <luangruo@yahoo.com>
Fri, 26 Nov 2021 05:21:48 +0000 (13:21 +0800)
* lisp/better-pixel-scroll.el (better-pixel-scroll-scroll-up):
Try to reset vscroll if already vscrolled.

lisp/better-pixel-scroll.el

index 6101778ac0a8c4bc027296626ed9845935900d41..c1469108e057b643da9e7f8b3b52277e118f5a00 100644 (file)
@@ -88,10 +88,11 @@ the height of the current window."
              (current-y (+ (cdr (posn-x-y posn))
                            (cdr (posn-object-width-height posn)))))
     (while (< (- max-y current-y) delta)
-      (when (zerop (vertical-motion -1))
-       (set-window-vscroll nil 0)
-       (signal 'beginning-of-buffer nil))
+      (vertical-motion -1)
       (setq current-y (- current-y (line-pixel-height)))))
+  (let ((current-vscroll (window-vscroll nil t)))
+    (setq delta (- delta current-vscroll))
+    (set-window-vscroll nil 0 t))
   (while (> delta 0)
     (set-window-start nil (save-excursion
                             (goto-char (window-start))