[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 1f990d1cf9: Fix pixel-scroll-precision in a corner case
From: |
Gerd Moellmann |
Subject: |
master 1f990d1cf9: Fix pixel-scroll-precision in a corner case |
Date: |
Tue, 23 Aug 2022 09:55:26 -0400 (EDT) |
branch: master
commit 1f990d1cf95930a584a7f70f002f284e273b6fd6
Author: Gerd Möllmann <gerd@gnu.org>
Commit: Gerd Möllmann <gerd@gnu.org>
Fix pixel-scroll-precision in a corner case
* lisp/pixel-scroll.el (pixel-scroll-precision-scroll-up-page): Handle
case that point cannot be found.
(pixel-scroll-precision-scroll-up): Handle case that window is one line high
(bug#57349)
---
lisp/pixel-scroll.el | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/lisp/pixel-scroll.el b/lisp/pixel-scroll.el
index 6dba733b9c..167cb4fabe 100644
--- a/lisp/pixel-scroll.el
+++ b/lisp/pixel-scroll.el
@@ -570,11 +570,12 @@ the height of the current window."
(window-header-line-height)
(- max-y delta))))
(point (posn-point posn))
- (up-point (save-excursion
- (goto-char point)
- (vertical-motion (- (1+ scroll-margin)))
- (point))))
- (when (> (point) up-point)
+ (up-point (and point
+ (save-excursion
+ (goto-char point)
+ (vertical-motion (- (1+ scroll-margin)))
+ (point)))))
+ (when (and point (> (point) up-point))
(when (let ((pos-visible (pos-visible-in-window-p up-point nil t)))
(or (eq (length pos-visible) 2)
(when-let* ((posn (posn-at-point up-point))
@@ -665,10 +666,11 @@ window being scrolled by DELTA pixels with an animation."
"Scroll the current window up by DELTA pixels."
(let ((max-height (- (window-text-height nil t)
(frame-char-height))))
- (while (> delta max-height)
- (pixel-scroll-precision-scroll-up-page max-height)
- (setq delta (- delta max-height)))
- (pixel-scroll-precision-scroll-up-page delta)))
+ (when (> max-height 0)
+ (while (> delta max-height)
+ (pixel-scroll-precision-scroll-up-page max-height)
+ (setq delta (- delta max-height)))
+ (pixel-scroll-precision-scroll-up-page delta))))
;; FIXME: This doesn't _always_ work when there's an image above the
;; current line that is taller than the window, and scrolling can
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 1f990d1cf9: Fix pixel-scroll-precision in a corner case,
Gerd Moellmann <=