aboutsummaryrefslogtreecommitdiff
path: root/evil-commands.el
diff options
context:
space:
mode:
Diffstat (limited to 'evil-commands.el')
-rw-r--r--evil-commands.el16
1 files changed, 10 insertions, 6 deletions
diff --git a/evil-commands.el b/evil-commands.el
index 8a54de7..3344c42 100644
--- a/evil-commands.el
+++ b/evil-commands.el
@@ -3826,13 +3826,17 @@ reveal.el. OPEN-SPOTS is a local version of `reveal-open-spots'."
(string-match-p "\n" (buffer-substring-no-properties
match-beg match-end)))
(setq zero-length-match (= match-beg match-end))
- (when (and (string= "^" evil-ex-substitute-regex)
- (= (point) end-marker))
+ (when (= match-end end-marker)
;; The range (beg end) includes the final newline which means
- ;; end-marker is on one line down. With the regex "^" the
- ;; beginning of this last line will be matched which we don't
- ;; want, so we abort here.
- (throw 'exit-search t))
+ ;; end-marker is on one line down, causing some issues...
+ (when (and (not match-contains-newline) (bolp))
+ ;; With the exception of explicitly substituting newlines,
+ ;; we abort when the match ends here and it's an empty line
+ (throw 'exit-search t))
+ (when (string= "^" evil-ex-substitute-regex)
+ ;; With the regex "^" the beginning of this last line
+ ;; will be matched which we don't want, so we abort here
+ (throw 'exit-search t)))
(setq evil-ex-substitute-last-point match-beg)
(if confirm
(let ((prompt