Skip to content

Commit 2000d65

Browse files
authored
evil-maybe-remove-spaces works for cc<escape> (#1493)
1 parent b0e2fa3 commit 2000d65

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

evil-commands.el

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1673,6 +1673,7 @@ of the block."
16731673
(funcall delete-func beg end type register yank-handler)
16741674
(cond
16751675
((eq type 'line)
1676+
(setq this-command 'evil-change-whole-line) ; for evil-maybe-remove-spaces
16761677
(if (= opoint (point))
16771678
(evil-open-above 1)
16781679
(evil-open-below 1)))

evil-states.el

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ commands opening a new line."
9999
evil-open-below
100100
evil-append
101101
evil-append-line
102+
evil-change-whole-line
102103
newline
103104
newline-and-indent
104105
indent-and-newline)))

evil-tests.el

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2114,6 +2114,28 @@ for this test."))
21142114
ABCIf you want to create a file, visit that file with C-x C-f,
21152115
ABCthen enter the text in that file's own buffer.")))
21162116

2117+
(ert-deftest evil-maybe-remove-spaces-test ()
2118+
"Test maybe removing (indentation) spaces after some commands when making a clear line."
2119+
:tags '(evil operator)
2120+
(ert-info ("changing the line and returning to normal mode removes spaces")
2121+
(evil-test-buffer
2122+
(emacs-lisp-mode)
2123+
("i(one two" [return] "three" [return] "four" [return] "five" [escape] "?three" [return])
2124+
"(one two
2125+
[t]hree
2126+
four
2127+
five"
2128+
("cc" "new line" [escape] "+")
2129+
"(one two
2130+
new line
2131+
[f]our
2132+
five"
2133+
("cc" [escape])
2134+
"(one two
2135+
new line
2136+
[]
2137+
five")))
2138+
21172139
(ert-deftest evil-test-change-word ()
21182140
"Test changing words"
21192141
:tags '(evil operator)

0 commit comments

Comments
 (0)