]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix pixel scroll for overlays and text in display properties
authorPo Lu <luangruo@yahoo.com>
Sat, 27 Nov 2021 11:23:31 +0000 (19:23 +0800)
committerPo Lu <luangruo@yahoo.com>
Sat, 27 Nov 2021 12:09:33 +0000 (20:09 +0800)
* lisp/pixel-scroll.el (pixel-scroll-precision-scroll-down):
Just set vscroll if we're scrolling through an overlay or
something to that effect.

lisp/pixel-scroll.el

index 92f66c89cef0d46a93073654695611a63c83124a..4280dc2587bb2cb1d6288b2939f5512f040d2520 100644 (file)
@@ -408,11 +408,18 @@ the height of the current window."
     (let* ((desired-pos (posn-at-x-y 0 (+ delta
                                          (window-tab-line-height)
                                          (window-header-line-height))))
+           (object (posn-object desired-pos))
           (desired-start (posn-point desired-pos))
           (desired-vscroll (cdr (posn-object-x-y desired-pos))))
-      (unless (eq (window-start) desired-start)
-        (set-window-start nil desired-start t))
-      (set-window-vscroll nil desired-vscroll t))))
+      (if (or (consp object) (stringp object))
+          ;; We are either on an overlay or a string, so set vscroll
+          ;; directly.
+          (set-window-vscroll nil (+ (window-vscroll nil t)
+                                     delta)
+                              t)
+        (unless (eq (window-start) desired-start)
+          (set-window-start nil desired-start t))
+        (set-window-vscroll nil desired-vscroll t)))))
 
 (defun pixel-scroll-precision-scroll-up (delta)
   "Scroll the current window up by DELTA pixels."