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

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

[nongnu] elpa/evil ebc78549ae: Account for large values of scroll-margin


From: ELPA Syncer
Subject: [nongnu] elpa/evil ebc78549ae: Account for large values of scroll-margin in evil-window-top+bottom
Date: Thu, 12 Dec 2024 19:00:31 -0500 (EST)

branch: elpa/evil
commit ebc78549aeb8fa334359df34f43ff355ca2ee04d
Author: Tom Dalziel <tom_dl@hotmail.com>
Commit: Tom Dalziel <33435574+tomdl89@users.noreply.github.com>

    Account for large values of scroll-margin in evil-window-top+bottom
---
 evil-commands.el | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/evil-commands.el b/evil-commands.el
index 4f6b731323..3b07e63812 100644
--- a/evil-commands.el
+++ b/evil-commands.el
@@ -889,7 +889,12 @@ In Insert state, insert a newline and indent."
   (evil-ensure-column
     (move-to-window-line
      (max (or count 0)
-          (if (= (point-min) (window-start)) 0 scroll-margin)))))
+          (if (or (zerop scroll-margin)
+                  (= (point-min) (window-start))
+                  (< (count-screen-lines (window-start) (point))
+                     scroll-margin))
+              0
+            scroll-margin)))))
 
 (evil-define-motion evil-window-middle ()
   "Move the cursor to the middle line in the window."
@@ -902,7 +907,13 @@ In Insert state, insert a newline and indent."
   :jump t
   :type line
   (evil-ensure-column
-    (move-to-window-line (- (max (or count 1) (1+ scroll-margin))))))
+    (move-to-window-line
+     (- (max (or count 1)
+             (if (or (zerop scroll-margin)
+                     (< (count-screen-lines (point) (window-end))
+                        scroll-margin))
+                 1
+               (1+ scroll-margin)))))))
 
 ;; scrolling
 (evil-define-command evil-scroll-line-up (count)



reply via email to

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