[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/evil 44080eb: Allow exit from insert, paste from . without
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/evil 44080eb: Allow exit from insert, paste from . without forward-char (#1550) |
Date: |
Thu, 9 Dec 2021 15:58:00 -0500 (EST) |
branch: elpa/evil
commit 44080eb3070642cc4f79e483a78712930dbf2797
Author: Tom Dalziel <33435574+tomdl89@users.noreply.github.com>
Commit: GitHub <noreply@github.com>
Allow exit from insert, paste from . without forward-char (#1550)
---
evil-commands.el | 55 ++++++++++++++++++++++++++++++-------------------------
evil-tests.el | 8 +++++++-
2 files changed, 37 insertions(+), 26 deletions(-)
diff --git a/evil-commands.el b/evil-commands.el
index c036ddd..0dd4ea8 100644
--- a/evil-commands.el
+++ b/evil-commands.el
@@ -2343,30 +2343,32 @@ when called interactively."
(setq macro (evil-get-register register t)
evil-last-register register)))
(list count macro)))
- (cond
- ((functionp macro)
- (evil-repeat-abort)
- (dotimes (_ (or count 1))
- (funcall macro)))
- ((or (and (not (stringp macro))
- (not (vectorp macro)))
- (member macro '("" [])))
- ;; allow references to currently empty registers
- ;; when defining macro
- (unless evil-this-macro
- (user-error "No previous macro")))
- (t
- (condition-case err
- (evil-with-single-undo
- (dotimes (_ (or count 1))
- (execute-kbd-macro macro)
- (when (eq 'evil-execute-in-normal-state last-command)
- (evil-change-state evil--execute-normal-return-state))))
- ;; enter Normal state if the macro fails
- (error
- (evil-normal-state)
- (evil-normalize-keymaps)
- (signal (car err) (cdr err)))))))
+ (let ((last-insertion-temp evil-last-insertion))
+ (cond
+ ((functionp macro)
+ (evil-repeat-abort)
+ (dotimes (_ (or count 1))
+ (funcall macro)))
+ ((or (and (not (stringp macro))
+ (not (vectorp macro)))
+ (member macro '("" [])))
+ ;; allow references to currently empty registers
+ ;; when defining macro
+ (unless evil-this-macro
+ (user-error "No previous macro")))
+ (t
+ (condition-case err
+ (evil-with-single-undo
+ (dotimes (_ (or count 1))
+ (execute-kbd-macro macro)
+ (when (eq 'evil-execute-in-normal-state last-command)
+ (evil-change-state evil--execute-normal-return-state)))
+ (setq evil-last-insertion last-insertion-temp))
+ ;; enter Normal state if the macro fails
+ (error
+ (evil-normal-state)
+ (evil-normalize-keymaps)
+ (signal (car err) (cdr err))))))))
;;; Visual commands
@@ -4722,7 +4724,10 @@ Restore the disabled repeat hooks on insert-state exit."
(not (memq this-command '(evil-insert
evil-goto-mark))))
(forward-char))
- (unless (eq 'replace evil-state)
+ (when (eq 'evil-paste-from-register this-command)
+ (evil-move-cursor-back t))
+ (unless (or (memq evil-state '(replace insert))
+ (eq 'evil-normal-state this-command))
(evil-change-state ',evil-state))
(when (eq 'insert evil-state)
(remove-hook 'pre-command-hook 'evil-repeat-pre-hook)
diff --git a/evil-tests.el b/evil-tests.el
index cc6d543..903a1ab 100644
--- a/evil-tests.el
+++ b/evil-tests.el
@@ -362,7 +362,13 @@ with `M-x evil-tests-run'"))
"[f]oo __ bar __ baz __ qux"
(evil-set-register ?q "f_cehi\C-o")
("@q1" [escape] "@q2")
- "foo hi1 bar hi2[] baz __ qux"))))
+ "foo hi1 bar hi2[] baz __ qux")
+ (ert-info ("Paste last insertion works after returning")
+ (evil-test-buffer
+ "[f]oo __ bar __ baz __ qux"
+ (evil-set-register ?q "f_ce\C-o")
+ ("@qhi" [escape] "@q\C-r.")
+ "foo hi bar hi[] baz __ qux")))))
(defun evil-test-suppress-keymap (state)
"Verify that `self-insert-command' is suppressed in STATE"
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [nongnu] elpa/evil 44080eb: Allow exit from insert, paste from . without forward-char (#1550),
ELPA Syncer <=