Skip to content

Commit

Permalink
No performant delete if range supplied
Browse files Browse the repository at this point in the history
Fixes #1858
  • Loading branch information
tomdl89 committed Jan 23, 2024
1 parent 59774e3 commit 9e27bb9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion evil-commands.el
Original file line number Diff line number Diff line change
Expand Up @@ -4212,7 +4212,7 @@ Use `evil-flush-lines' if INVERT is nil, or `evil-keep-lines' if not."
(when (and pattern command)
(when evil-ex-search-vim-style-regexp
(setq pattern (evil-transform-vim-style-regexp pattern)))
(if (and ex-delete (not (nth 3 command-form)))
(if (and ex-delete (not (nth 3 command-form)) (not (nth 1 command-form)))
(evil--ex-performant-global-delete beg end pattern invert)
(setq isearch-string pattern)
(isearch-update-ring pattern t)
Expand Down
5 changes: 5 additions & 0 deletions evil-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -8668,6 +8668,11 @@ maybe we need one line more with some text\n")
"[n]o 1\nno 2\nno 3\nyes 4\nno 5\nno 6\nno 7\n"
(":g/yes/d2" [return])
"no 1\nno 2\nno 3\n[n]o 6\nno 7\n"))
(ert-info ("global delete with range")
(evil-test-buffer
"alpha\nbravo\ncharlie\ndelta\ncharlie\necho\ngolf\ncharlie\nhotel"
(":g/charlie/-1d")
"alpha\ncharlie\ncharlie\necho\ncharlie\nhotel"))
(ert-info ("global substitute")
(evil-test-buffer
"[n]o 1\nno 2\nno 3\nyes 4\nno 5\nno 6\nno 7\n"
Expand Down

0 comments on commit 9e27bb9

Please sign in to comment.