From 9b0ff1832b36096f6606f824f081e69e3a522b37 Mon Sep 17 00:00:00 2001 From: James Cherti <60946298+jamescherti@users.noreply.github.com> Date: Thu, 7 Nov 2024 11:07:04 -0500 Subject: [PATCH] Fix issue: No visible text when cursor is moved to the end of buffer 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)`. --- evil-commands.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/evil-commands.el b/evil-commands.el index 2e3a26a2..cba1af6f 100644 --- a/evil-commands.el +++ b/evil-commands.el @@ -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 to + ;; position it near the bottom. + (overlay-recenter (point)) + (recenter -1))) (goto-char (point-min)) (forward-line (1- count)))))