Skip to content

Commit

Permalink
Fix issue: No visible text when cursor is moved to the end of buffer
Browse files Browse the repository at this point in the history
This pull request fixes an issue where using `(evil-goto-line nil)` to
move the cursor to the end of the buffer would result in no visible
text.

This patch draws inspiration from the built-in `(end-of-buffer)`
function, which does not exhibit the same issue as calling
`(evil-goto-line nil)`.
  • Loading branch information
jamescherti committed Nov 7, 2024
1 parent 81ec688 commit 9d07b8e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion evil-commands.el
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,14 @@ of the current screen line."
:type line
(evil-ensure-column
(if (null count)
(goto-char (point-max))
(progn
(goto-char (point-max))
(when (and (eq (current-buffer) (window-buffer))
(> (point) (window-end nil t)))
;; If the end of the buffer is not already on the screen, scroll in
;; a special way to position it near the bottom.
(overlay-recenter (point))
(recenter -1)))
(goto-char (point-min))
(forward-line (1- count)))))

Expand Down

0 comments on commit 9d07b8e

Please sign in to comment.