From 0b4790566512a5c399abd758cf8e665958949da9 Mon Sep 17 00:00:00 2001 From: Tom Dalziel Date: Tue, 7 May 2024 23:02:00 +0200 Subject: [PATCH] Chosing register keeps eol anchoring in visual block state --- evil-common.el | 2 +- evil-states.el | 2 +- evil-tests.el | 8 +++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/evil-common.el b/evil-common.el index 4397a9c3..d2e9d29b 100644 --- a/evil-common.el +++ b/evil-common.el @@ -2275,7 +2275,7 @@ be passed via ARGS." ;; ensure the start column is the left one. (evil-sort startcol endcol) ;; maybe extend up to EOL - (when (and (memq last-command '(next-line previous-line)) + (when (and (memq last-command '(next-line previous-line evil-use-register)) (eq temporary-goal-column most-positive-fixnum)) (goto-char startpt) (while (< (point) endpt) diff --git a/evil-states.el b/evil-states.el index 402ea85e..6b86d9de 100644 --- a/evil-states.el +++ b/evil-states.el @@ -643,7 +643,7 @@ Reuse overlays where possible to prevent flicker." (setq beg (progn (goto-char beg) (evil-move-to-column beg-col)) end (progn (goto-char end) (evil-move-to-column end-col 1)))) ;; maybe extend end column to EOL - (and (memq this-command '(next-line previous-line)) + (and (memq this-command '(next-line previous-line evil-use-register)) (eq temporary-goal-column most-positive-fixnum) (setq end-col most-positive-fixnum)) ;; force a redisplay so we can do reliable window diff --git a/evil-tests.el b/evil-tests.el index dcf8fce8..1bcdc815 100644 --- a/evil-tests.el +++ b/evil-tests.el @@ -3245,7 +3245,13 @@ word3[]")) (evil-test-buffer "[a]lpha bravo charlie delta" ("vf \"xd" "dw" ";\"xp") - "charlie alpha delta"))) + "charlie alpha delta")) + (ert-info ("Choosing register keeps eol anchoring") + (evil-test-buffer + "[a]aaaaa\nbbbbb\ncccc" + ("\C-v" "2j" "$" "\"xy" "G" "o" [escape] "\"xp") + ;; TODO will fail because it inserts a left col of spaces + "aaaaaa\nbbbbb\ncccc\n[a]aaaaa\nbbbbb\ncccc"))) (ert-deftest evil-test-last-insert-register () "Test last insertion register."