diff options
| author | Tom Dalziel <tom_dl@hotmail.com> | 2024-12-13 00:21:21 +0100 |
|---|---|---|
| committer | Tom Dalziel <33435574+tomdl89@users.noreply.github.com> | 2024-12-12 23:35:23 +0000 |
| commit | ebc78549aeb8fa334359df34f43ff355ca2ee04d (patch) | |
| tree | 05efa88784f3cf7f6b050f23fe7576f868f9f2fd /evil-commands.el | |
| parent | b7ab3840dbfc1da5f9ad56542fc94e3dab4be5f1 (diff) | |
Account for large values of scroll-margin in evil-window-top+bottom
Diffstat (limited to 'evil-commands.el')
| -rw-r--r-- | evil-commands.el | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/evil-commands.el b/evil-commands.el index 4f6b731..3b07e63 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) |
