emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/scroll-on-drag 494de949d5 04/35: Restore indent level


From: ELPA Syncer
Subject: [nongnu] elpa/scroll-on-drag 494de949d5 04/35: Restore indent level
Date: Thu, 7 Jul 2022 12:02:43 -0400 (EDT)

branch: elpa/scroll-on-drag
commit 494de949d517c4d2345d4ac3cd62cb67e0483318
Author: Campbell Barton <ideasman42@gmail.com>
Commit: Campbell Barton <ideasman42@gmail.com>

    Restore indent level
---
 scroll-on-drag.el | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/scroll-on-drag.el b/scroll-on-drag.el
index 56af588e18..d46c493cee 100644
--- a/scroll-on-drag.el
+++ b/scroll-on-drag.el
@@ -92,6 +92,9 @@
       (restore-window-start (window-start))
       (restore-point (point))
 
+      ;; Restore indent (lost when scrolling).
+      (restore-indent (- (point) (save-excursion (back-to-indentation) 
(point))))
+
       (mouse-y-fn
         (cond
           ((eq scroll-on-drag-style 'line)
@@ -317,6 +320,14 @@
 
     (funcall timer-stop-fn)
 
+    ;; Restore indent level if possible.
+    (when (and has-scrolled (> restore-indent 0))
+      (move-beginning-of-line nil)
+      (right-char
+        (min
+          restore-indent
+          (- (save-excursion (move-end-of-line nil) (point)) (point)))))
+
     ;; Result so we know if any scrolling occurred,
     ;; allowing a fallback action on 'click'.
     has-scrolled))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]