From: Po Lu Date: Fri, 26 Nov 2021 05:21:48 +0000 (+0800) Subject: Make pixel scrolling through images at the first line smoother X-Git-Tag: emacs-29.0.90~2852^2~27 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=897a101cd3b7d6b46e3b14e80e3c77373246be6a;p=emacs.git Make pixel scrolling through images at the first line smoother * lisp/better-pixel-scroll.el (better-pixel-scroll-scroll-up): Try to reset vscroll if already vscrolled. --- diff --git a/lisp/better-pixel-scroll.el b/lisp/better-pixel-scroll.el index 6101778ac0a..c1469108e05 100644 --- a/lisp/better-pixel-scroll.el +++ b/lisp/better-pixel-scroll.el @@ -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))