Skip to content

Commit

Permalink
Allow evil-undo in visual state again (undo in region)
Browse files Browse the repository at this point in the history
Undo in region can be very useful and is supported by all undo backends.
Before emacs-evil#1888, `evil-undo` stayed in visual state, and I think restoring this
behaviour should not negatively affect the fix for emacs-evil#1883.
  • Loading branch information
fnussbaum authored and tomdl89 committed Jan 11, 2025
1 parent 6bed0e5 commit 5774d0d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions evil-commands.el
Original file line number Diff line number Diff line change
Expand Up @@ -1764,9 +1764,9 @@ Add (add-hook 'evil-local-mode-hook 'turn-on-undo-tree-mode) to your init file f
(interactive "*p")
(evil--check-undo-system)
(let ((state-before evil-state))
(unless (eq 'normal state-before) (evil-normal-state))
(unless (memq state-before '(normal visual)) (evil-normal-state))
(funcall evil-undo-function count)
(unless (eq 'normal state-before) (evil-change-state state-before))))
(unless (memq state-before '(normal visual)) (evil-change-state state-before))))

(evil-define-command evil-redo (count)
"Undo COUNT changes in buffer using `evil-redo-function'."
Expand Down

0 comments on commit 5774d0d

Please sign in to comment.