summaryrefslogtreecommitdiff
path: root/lisp/pixel-scroll.el
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2021-12-02 09:56:52 +0800
committerPo Lu <luangruo@yahoo.com>2021-12-02 09:56:52 +0800
commita4ff841154632da36ccb1bd01ea4e509465a692b (patch)
tree1cb092088f6a0f079dfa93e2fedcb54161c3cfa0 /lisp/pixel-scroll.el
parent01a6c0b409c4d9ad92c4bb99bdb06c742bf3b0dd (diff)
downloademacs-a4ff841154632da36ccb1bd01ea4e509465a692b.tar.gz
emacs-a4ff841154632da36ccb1bd01ea4e509465a692b.tar.bz2
emacs-a4ff841154632da36ccb1bd01ea4e509465a692b.zip
Fix precision scrolling when there is a scroll margin
* lisp/pixel-scroll.el (pixel-scroll-precision-scroll-down) (pixel-scroll-precision-scroll-up): Take scroll margin into accout.
Diffstat (limited to 'lisp/pixel-scroll.el')
-rw-r--r--lisp/pixel-scroll.el4
1 files changed, 2 insertions, 2 deletions
diff --git a/lisp/pixel-scroll.el b/lisp/pixel-scroll.el
index 9cd2352e199..2d6531a2d17 100644
--- a/lisp/pixel-scroll.el
+++ b/lisp/pixel-scroll.el
@@ -383,7 +383,7 @@ the height of the current window."
(desired-vscroll (cdr (posn-object-x-y desired-pos)))
(next-pos (save-excursion
(goto-char desired-start)
- (when (zerop (vertical-motion 1))
+ (when (zerop (vertical-motion (1+ scroll-margin)))
(signal 'end-of-buffer nil))
(point))))
(if (and (< (point) next-pos)
@@ -419,7 +419,7 @@ the height of the current window."
(point (posn-point posn))
(up-point (save-excursion
(goto-char point)
- (vertical-motion -1)
+ (vertical-motion (- (1+ scroll-margin)))
(point))))
(when (> (point) up-point)
(when (let ((pos-visible (pos-visible-in-window-p up-point nil t)))