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

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

[nongnu] elpa/scroll-on-jump 93dbd780cc 1/5: Workaround bug in evil visu


From: ELPA Syncer
Subject: [nongnu] elpa/scroll-on-jump 93dbd780cc 1/5: Workaround bug in evil visual line mode
Date: Sat, 7 Jan 2023 19:59:59 -0500 (EST)

branch: elpa/scroll-on-jump
commit 93dbd780cc84bf87e735744f84be235b4d56df9e
Author: Campbell Barton <ideasman42@gmail.com>
Commit: Campbell Barton <ideasman42@gmail.com>

    Workaround bug in evil visual line mode
    
    Evil visual line mode would scroll back to the original location
    after scrolling completed.
---
 scroll-on-jump.el | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/scroll-on-jump.el b/scroll-on-jump.el
index 8e3c5b4722..7c59dbb292 100644
--- a/scroll-on-jump.el
+++ b/scroll-on-jump.el
@@ -139,6 +139,22 @@ Argument ALSO-MOVE-POINT When non-nil, move the POINT as 
well."
   "Blend FACTOR between A and B using ease style curvature."
   (+ a (* (- b a) (- (* 3.0 factor factor) (* 2.0 factor factor factor)))))
 
+(defsubst scroll-on-jump--evil-visual-mode-workaround ()
+  "Workaround for `evil-mode' line-mode."
+  ;; Without this, the line mode point jumps back to the origin,
+  ;; the mark needs to be set to the `point'.
+  ;; https://github.com/emacs-evil/evil/issues/1708
+  (when
+    (and
+      (fboundp 'evil-visual-state-p)
+      (funcall 'evil-visual-state-p)
+      (fboundp 'evil-visual-type)
+      (eq (funcall 'evil-visual-type) 'line)
+      (boundp 'evil-visual-point))
+    (let ((mark (symbol-value 'evil-visual-point)))
+      (when (markerp mark)
+        (set-marker mark (point))))))
+
 
 ;; ---------------------------------------------------------------------------
 ;; Internal Logic
@@ -516,7 +532,9 @@ Argument USE-WINDOW-START detects window scrolling when 
non-nil."
               (prog1 (goto-char point-next)
                 (redisplay t)))
             (t
-              (scroll-on-jump-auto-center window point-prev point-next))))))))
+              (scroll-on-jump-auto-center window point-prev point-next)))
+
+          (scroll-on-jump--evil-visual-mode-workaround))))))
 
 
 ;; ---------------------------------------------------------------------------



reply via email to

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