diff options
author | Po Lu <luangruo@yahoo.com> | 2021-12-01 11:22:58 +0800 |
---|---|---|
committer | Po Lu <luangruo@yahoo.com> | 2021-12-01 11:22:58 +0800 |
commit | 541f61b378eca85fa118caff5ad97b56171baa98 (patch) | |
tree | 81553333d09fe1e0d22a657fdf21be647b28ca4b /lisp/pixel-scroll.el | |
parent | 034d8a3ea8437a6ef88d33275e2a5818380afd74 (diff) | |
download | emacs-541f61b378eca85fa118caff5ad97b56171baa98.tar.gz emacs-541f61b378eca85fa118caff5ad97b56171baa98.tar.bz2 emacs-541f61b378eca85fa118caff5ad97b56171baa98.zip |
Avoid unnecessary call when pixel scrolling
* lisp/pixel-scroll.el (pixel-scroll-precision-scroll-down):
Avoid unnecessary call to `posn-at-point'
Diffstat (limited to 'lisp/pixel-scroll.el')
-rw-r--r-- | lisp/pixel-scroll.el | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lisp/pixel-scroll.el b/lisp/pixel-scroll.el index f514a010ad0..65671534865 100644 --- a/lisp/pixel-scroll.el +++ b/lisp/pixel-scroll.el @@ -388,13 +388,14 @@ the height of the current window." (point)))) (if (and (< (point) next-pos) (let ((pos-visibility (pos-visible-in-window-p next-pos nil t))) - (or (eq (length pos-visibility) 2) - (when-let* ((posn (posn-at-point next-pos)) - (edges (window-edges nil t)) - (usable-height (- (nth 3 edges) - (nth 1 edges)))) - (> (cdr (posn-object-width-height posn)) - usable-height))))) + (and pos-visibility + (or (eq (length pos-visibility) 2) + (when-let* ((posn (posn-at-point next-pos)) + (edges (window-edges nil t)) + (usable-height (- (nth 3 edges) + (nth 1 edges)))) + (> (cdr (posn-object-width-height posn)) + usable-height)))))) (goto-char next-pos)) (if (or (consp object) (stringp object)) ;; We are either on an overlay or a string, so set vscroll |