aboutsummaryrefslogtreecommitdiff
path: root/evil-search.el
diff options
context:
space:
mode:
authorAxel Forsman <axelsfor@gmail.com>2023-02-09 22:14:57 +0100
committerAxel Forsman <axelsfor@gmail.com>2023-02-20 19:05:23 +0100
commit22d76a4080e40381aae194c94f3bc16ba67a330a (patch)
tree5cbb2de1d3c522cd16e610d884d745a60cf1775f /evil-search.el
parent2ce03d412c4e93b0b89eb43d796c991806415b8a (diff)
Restore match data after eval:ing replacement
This fixes #1481. Also pass along the number of the current replacement to function called to generate each replacement, which fixes #1411.
Diffstat (limited to 'evil-search.el')
-rw-r--r--evil-search.el21
1 files changed, 9 insertions, 12 deletions
diff --git a/evil-search.el b/evil-search.el
index a662a73..b42d924 100644
--- a/evil-search.el
+++ b/evil-search.el
@@ -1240,18 +1240,15 @@ This handler highlights the pattern of the current substitution."
(defun evil-ex-pattern-update-replacement (_hl overlay)
"Update the replacement display."
- (when (fboundp 'match-substitute-replacement)
- (let ((fixedcase (not case-replace))
- repl)
- (setq repl (if evil-ex-substitute-current-replacement
- (evil-match-substitute-replacement
- evil-ex-substitute-current-replacement
- fixedcase)
- ""))
- (put-text-property 0 (length repl)
- 'face 'evil-ex-substitute-replacement
- repl)
- (overlay-put overlay 'after-string repl))))
+ (let ((repl (if evil-ex-substitute-current-replacement
+ (evil-match-substitute-replacement
+ evil-ex-substitute-current-replacement
+ (not case-replace))
+ "")))
+ (put-text-property 0 (length repl)
+ 'face 'evil-ex-substitute-replacement
+ repl)
+ (overlay-put overlay 'after-string repl)))
(defun evil-ex-parse-global (string)
"Parse STRING as a global argument."