branch: elpa/evil
commit 1a5ddab958982b6bf5e21bc7cb0f77a64415479d
Author: Tom Dalziel <[email protected]>
Commit: Tom Dalziel <[email protected]>

    gi works in visual line state
---
 evil-commands.el |  5 ++++-
 evil-tests.el    | 21 +++++++++++++++++++++
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/evil-commands.el b/evil-commands.el
index 3a0b3b3588..45a6e67a1c 100644
--- a/evil-commands.el
+++ b/evil-commands.el
@@ -2734,11 +2734,14 @@ the lines."
     (evil-insert count vcount skip-empty-lines)
     (add-hook 'post-command-hook #'evil-maybe-remove-spaces)))
 
-(defun evil-insert-resume (count)
+(evil-define-command evil-insert-resume (count)
   "Switch to Insert state at previous insertion point.
 The insertion will be repeated COUNT times. If called from visual
 state, only place point at the previous insertion position but do not
 switch to insert state."
+  :keep-visual t
+  :type exclusive
+  :jump t
   (interactive "p")
   (evil-goto-mark ?^ t)
   (unless (evil-visual-state-p)
diff --git a/evil-tests.el b/evil-tests.el
index fb06d762cf..7ccef73275 100644
--- a/evil-tests.el
+++ b/evil-tests.el
@@ -6075,6 +6075,27 @@ This buffer is for notes."
    ("]}")
    "{ (\"Test with paren {inside multi {level}[}]\", test()); } "))
 
+(ert-deftest evil-test-insert-resume ()
+  "Test `evil-insert-resume'"
+  :tags '(evil motion)
+  (ert-info ("Can move to last insert location and take a count")
+    (evil-test-buffer
+      "alpha bravo [ ]delta echo"
+      ("i" "charlie" [escape] "^")
+      "[a]lpha bravo charlie delta echo"
+      ("2gi" " zulu" [escape])
+      "alpha bravo charlie zulu zul[u] delta echo"))
+  (ert-info ("Can move to `^' marker in visual line state")
+    (evil-test-buffer
+      "alpha [b]ravo\ncharlie delta\necho foxtrot"
+      ("i" [escape] "/foxtrot" [return])
+      "alpha bravo\ncharlie delta\necho [f]oxtrot"
+      ("Vk")
+      "alpha bravo\ncharl[i]e delta\necho foxtrot"
+      ("gi")
+      "alpha [b]ravo\ncharlie delta\necho foxtrot"
+      ("vd")
+      "alpha [o]xtrot")))
 
 (ert-deftest evil-test-next-mark ()
   "Test `evil-next-mark', `evil-previous-mark'"

Reply via email to