diff options
| author | Tom Dalziel <33435574+tomdl89@users.noreply.github.com> | 2023-09-20 00:06:08 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-20 00:06:08 +0200 |
| commit | d28206ccff74bc07ba335b8ff77805564f6928d7 (patch) | |
| tree | be67de80b99d736ac54e90b9a2281e3cacb47bbf /evil-search.el | |
| parent | 5fc16776c5eb00c956ec7e9d83facb6a38dd868d (diff) | |
Disable vim-style-regexp conversions of already converted patterns (#1827)
* (Failing) test for `&` with very-magic vim-style backreferences
* Disable vim-style-regexp conversions of already converted patterns
Diffstat (limited to 'evil-search.el')
| -rw-r--r-- | evil-search.el | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/evil-search.el b/evil-search.el index d4f870b..9f283a2 100644 --- a/evil-search.el +++ b/evil-search.el @@ -1158,7 +1158,7 @@ special situations like empty patterns or repetition of previous substitution commands. If IMPLICIT-R is non-nil, then the \"r\" flag is assumed, i.e. in case of an empty pattern the last search pattern is used. It is meant for :substitute commands with arguments." - (let (pattern replacement flags) + (let (pattern replacement flags using-prev-pattern) (cond ((or (string= string "") (string-match-p "\\`[a-zA-Z]" string)) ;; No pattern, since it starts with a letter which cannot be a @@ -1191,8 +1191,10 @@ is used. It is meant for :substitute commands with arguments." (if (eq evil-search-module 'evil-search) (if (and evil-ex-last-was-search (memq ?r flags)) (and evil-ex-search-pattern + (setq using-prev-pattern t) (evil-ex-pattern-regex evil-ex-search-pattern)) (and evil-ex-substitute-pattern + (setq using-prev-pattern t) (evil-ex-pattern-regex evil-ex-substitute-pattern))) (if (eq case-fold-search t) isearch-string @@ -1200,7 +1202,11 @@ is used. It is meant for :substitute commands with arguments." flags (remq ?r flags))) ;; generate pattern (when pattern - (setq pattern (evil-ex-make-substitute-pattern pattern flags))) + ;; Disable vim-style regexp conversion if using a previous pattern, because + ;; this conversion will already have been done before storing it + (let ((evil-ex-search-vim-style-regexp (and evil-ex-search-vim-style-regexp + (not using-prev-pattern)))) + (setq pattern (evil-ex-make-substitute-pattern pattern flags)))) (list pattern replacement flags))) (defun evil-ex-nohighlight () |
