From 4dc283c8344991ad5d8b03d95f43f719a978ee8b Mon Sep 17 00:00:00 2001 From: James Cherti <60946298+jamescherti@users.noreply.github.com> Date: Sun, 10 Nov 2024 16:57:09 -0500 Subject: [PATCH 1/2] Fix issue: No visible text when cursor is moved to the end of the buffer When the user sets `scroll-conservatively` to a value greater than 100, moving the cursor to `(point-max)` with `(evil-goto-line nil)` can cause all text to be positioned above the window start, making it invisible to the user. This issue is more likely to occur after scaling the text using functions such as `text-scale-increase` or `text-scale-set`. This commit resolves this issue by adjusting the window's view using `(recenter -1)`. By doing so, it prevents the cursor from being placed off-screen, ensuring that the user can always see the relevant text when moving to the end of the buffer. When `scroll-conservatively` is less than or equal to 100, Emacs recenters the screen using `(recenter nil)`, which recenters with point on the middle line. This behavior does not match Vim's. To align with Vim's behavior, we use `(recenter -1)`, regardless of the value of `scroll-conservatively`. --- evil-commands.el | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/evil-commands.el b/evil-commands.el index 2e3a26a2..341e4981 100644 --- a/evil-commands.el +++ b/evil-commands.el @@ -254,7 +254,18 @@ 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))) + ;; When the user sets `scroll-conservatively` to a value greater + ;; than 100, moving the cursor to `(point-max)` with + ;; `(evil-goto-line nil)` can result in all text being located above + ;; the window start, preventing the user from seeing it. + ;; + ;; The following addresses this issue: + (overlay-recenter (point)) + (recenter -1))) (goto-char (point-min)) (forward-line (1- count))))) From fde4748f9fecfb12acd2439745a9ac27852e70b4 Mon Sep 17 00:00:00 2001 From: James Cherti <60946298+jamescherti@users.noreply.github.com> Date: Thu, 14 Nov 2024 08:46:01 -0500 Subject: [PATCH 2/2] Remove .dir-locals.el --- .dir-locals.el | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 .dir-locals.el diff --git a/.dir-locals.el b/.dir-locals.el deleted file mode 100644 index d79ba71b..00000000 --- a/.dir-locals.el +++ /dev/null @@ -1,3 +0,0 @@ -;; Don't use tabs for el files -((emacs-lisp-mode . - ((indent-tabs-mode . nil))))