aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPo Lu2021-11-30 20:44:54 +0800
committerPo Lu2021-11-30 20:44:54 +0800
commit6c17cdc1dc04697398811d96e40a9a3ad07bbd3f (patch)
tree9114b76360ac5cf6e2eafeedacee8ac5721db614
parentb79d779ae839d0484b24967b4753df9e9b85f614 (diff)
downloademacs-6c17cdc1dc04697398811d96e40a9a3ad07bbd3f.tar.gz
emacs-6c17cdc1dc04697398811d96e40a9a3ad07bbd3f.zip
Fix 1-off errors in pixel scrolling code
* lisp/pixel-scroll.el (pixel-scroll-precision-scroll-down): Fix one-off errors.
-rw-r--r--lisp/pixel-scroll.el6
1 files changed, 3 insertions, 3 deletions
diff --git a/lisp/pixel-scroll.el b/lisp/pixel-scroll.el
index 097e4e53ddc..cc90be021f7 100644
--- a/lisp/pixel-scroll.el
+++ b/lisp/pixel-scroll.el
@@ -424,15 +424,15 @@ the height of the current window."
424(defun pixel-scroll-precision-scroll-up (delta) 424(defun pixel-scroll-precision-scroll-up (delta)
425 "Scroll the current window up by DELTA pixels." 425 "Scroll the current window up by DELTA pixels."
426 (let* ((edges (window-edges nil t nil t)) 426 (let* ((edges (window-edges nil t nil t))
427 (max-y (- (nth 3 edges) 427 (max-y (- (nth 3 edges) 1
428 (window-tab-line-height) 428 (window-tab-line-height)
429 (window-header-line-height))) 429 (window-header-line-height)))
430 (usable-height (- max-y (nth 1 edges)))) 430 (usable-height (- max-y (nth 1 edges))))
431 (when-let* ((posn (posn-at-point)) 431 (when-let* ((posn (posn-at-point))
432 (current-y (+ (cdr (posn-x-y posn)) 432 (current-y (+ (cdr (posn-x-y posn))
433 (line-pixel-height)))) 433 (line-pixel-height))))
434 (while (and (< (- max-y current-y) delta) 434 (while (and (<= (- max-y current-y) delta)
435 (< (cdr (posn-object-width-height posn)) 435 (<= (cdr (posn-object-width-height posn))
436 usable-height)) 436 usable-height))
437 (vertical-motion -1) 437 (vertical-motion -1)
438 (setq current-y (- current-y (line-pixel-height)))) 438 (setq current-y (- current-y (line-pixel-height))))