Skip to content

Commit

Permalink
Ex-substitute: use last search's case-sensitivity
Browse files Browse the repository at this point in the history
  • Loading branch information
tomdl89 committed Jun 3, 2024
1 parent 9fada78 commit 3ba76c1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions evil-search.el
Original file line number Diff line number Diff line change
Expand Up @@ -1200,6 +1200,9 @@ is used. It is meant for :substitute commands with arguments."
isearch-string
(concat isearch-string "\\C")))
flags (remq ?r flags)))
(when (and using-prev-pattern
(not (evil-ex-pattern-ignore-case evil-ex-search-pattern)))
(setq pattern (concat pattern "\\C")))
;; generate pattern
(when pattern
;; Disable vim-style regexp conversion if using a previous pattern, because
Expand Down
8 changes: 8 additions & 0 deletions evil-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -8206,6 +8206,14 @@ golf h[o]>tel")))
"[x]xx AAA bar AAA bar AAA bar\nxxx foo bar foo bar foo bar"
("g&")
"xxx AAA bar AAA bar AAA bar\n[x]xx AAA bar AAA bar AAA bar"))
(ert-info ("Substitute with last search, maintaining case sensitivty")
(evil-select-search-module 'evil-search-module 'evil-search)
(evil-test-buffer
"[a]lpha\nbravo\nbravo\ncharlie\nBravo\ndelta"
("/\\Cbravo" [return])
"alpha\n[b]ravo\nbravo\ncharlie\nBravo\ndelta"
(":%s//zulu" [return])
"alpha\nzulu\n[z]ulu\ncharlie\nBravo\ndelta"))
(ert-info ("Repeat magic multiple times")
(let ((evil-magic 'very-magic)
(evil-ex-search-vim-style-regexp t))
Expand Down

0 comments on commit 3ba76c1

Please sign in to comment.