aboutsummaryrefslogtreecommitdiff
path: root/evil-commands.el
diff options
context:
space:
mode:
authorTom Dalziel <33435574+tomdl89@users.noreply.github.com>2024-04-15 12:09:33 +0200
committerGitHub <noreply@github.com>2024-04-15 12:09:33 +0200
commiteae05b5a1b2de6fe2d262a9fc0fd24e46bebc2c8 (patch)
treee4730cfc0a8a2ff52eb3b0e3bb908b649353b017 /evil-commands.el
parentf4bacddbf3e56f53dab64e2b071e743cb42e8677 (diff)
Always undo in normal state (#1888)
Diffstat (limited to 'evil-commands.el')
-rw-r--r--evil-commands.el5
1 files changed, 4 insertions, 1 deletions
diff --git a/evil-commands.el b/evil-commands.el
index a44cc25..82fadf2 100644
--- a/evil-commands.el
+++ b/evil-commands.el
@@ -1778,7 +1778,10 @@ Add (add-hook 'evil-local-mode-hook 'turn-on-undo-tree-mode) to your init file f
:jump t
(interactive "*p")
(evil--check-undo-system)
- (funcall evil-undo-function count))
+ (let ((state-before evil-state))
+ (unless (eq 'normal state-before) (evil-normal-state))
+ (funcall evil-undo-function count)
+ (unless (eq 'normal state-before) (evil-change-state state-before))))
(evil-define-command evil-redo (count)
"Undo COUNT changes in buffer using `evil-redo-function'."