branch: elpa/evil
commit 3641c6e619fd3caef15c9e9a9e4420a57e079f2c
Author: Axel Forsman <[email protected]>
Commit: Axel Forsman <[email protected]>
Exclude autoindentation from previous insertion
Fixes #1761
---
evil-commands.el | 8 ++++----
evil-tests.el | 9 ++++++++-
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/evil-commands.el b/evil-commands.el
index 6e35689e6c..b66268def7 100644
--- a/evil-commands.el
+++ b/evil-commands.el
@@ -2701,9 +2701,9 @@ The insertion will be repeated COUNT times."
(setq evil-insert-count count
evil-insert-lines t
evil-insert-vcount nil)
- (evil-insert-state 1)
(when evil-auto-indent
- (indent-according-to-mode)))
+ (indent-according-to-mode))
+ (evil-insert-state 1))
(evil-define-command evil-open-below (count)
"Insert a new line below point and switch to Insert state.
@@ -2717,9 +2717,9 @@ The insertion will be repeated COUNT times."
(setq evil-insert-count count
evil-insert-lines t
evil-insert-vcount nil)
- (evil-insert-state 1)
(when evil-auto-indent
- (indent-according-to-mode)))
+ (indent-according-to-mode))
+ (evil-insert-state 1))
(defun evil--insert-line (count vcount non-blank-p)
"Switch to insert state at the beginning of the current line.
diff --git a/evil-tests.el b/evil-tests.el
index 3bce20d3d4..d577b35b8e 100644
--- a/evil-tests.el
+++ b/evil-tests.el
@@ -792,7 +792,14 @@ de[f]
(ert-info ("Moving the cursor starts a new insertion")
(evil-test-buffer
("iabc" [left] "xxx" [escape] "o\C-a")
- "abxxxc\nxxx")))
+ "abxxxc\nxxx"))
+ (ert-info ("Autoindentation should be excluded")
+ (evil-test-buffer "\(setq x"
+ (emacs-lisp-mode)
+ ("o0\)" [escape] "o\C-a")
+ "(setq x
+ 0)
+0\)")))
;;; Repeat system