aboutsummaryrefslogtreecommitdiff
path: root/evil-ex.el
diff options
context:
space:
mode:
authorTom Dalziel <33435574+tomdl89@users.noreply.github.com>2021-06-28 21:13:55 +0200
committerGitHub <noreply@github.com>2021-06-28 21:13:55 +0200
commitf20d442ff006aa5a6dc48ac654906b48b95107fd (patch)
treea23605688abc2b9d1bc154361885ef81ccd4f611 /evil-ex.el
parent6dbb2d82c5e8d8a5c934ce7a9f93e3f8eff51665 (diff)
Fix 1482 addr wraparound (#1483)
* Add wraparound to `evil-ex-re-fwd` + `evil-ex-re-bwd` Fixes a bug noted in #1482 * Tests for 1482
Diffstat (limited to 'evil-ex.el')
-rw-r--r--evil-ex.el14
1 files changed, 10 insertions, 4 deletions
diff --git a/evil-ex.el b/evil-ex.el
index a5aa342..709386e 100644
--- a/evil-ex.el
+++ b/evil-ex.el
@@ -814,8 +814,11 @@ Returns the line number of the match."
(save-excursion
(set-text-properties 0 (length pattern) nil pattern)
(evil-move-end-of-line)
- (and (re-search-forward pattern nil t)
- (line-number-at-pos (1- (match-end 0))))))
+ (if (re-search-forward pattern nil t)
+ (line-number-at-pos (1- (match-end 0)))
+ (goto-char (point-min))
+ (and (re-search-forward pattern nil t)
+ (line-number-at-pos (1- (match-end 0)))))))
(invalid-regexp
(evil-ex-echo (cadr err))
nil)))
@@ -828,8 +831,11 @@ Returns the line number of the match."
(save-excursion
(set-text-properties 0 (length pattern) nil pattern)
(evil-move-beginning-of-line)
- (and (re-search-backward pattern nil t)
- (line-number-at-pos (match-beginning 0)))))
+ (if (re-search-backward pattern nil t)
+ (line-number-at-pos (match-beginning 0))
+ (goto-char (point-max))
+ (and (re-search-backward pattern nil t)
+ (line-number-at-pos (match-beginning 0))))))
(invalid-regexp
(evil-ex-echo (cadr err))
nil)))