diff options
| author | Tom Dalziel <33435574+tomdl89@users.noreply.github.com> | 2021-06-28 21:13:55 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-28 21:13:55 +0200 |
| commit | f20d442ff006aa5a6dc48ac654906b48b95107fd (patch) | |
| tree | a23605688abc2b9d1bc154361885ef81ccd4f611 /evil-ex.el | |
| parent | 6dbb2d82c5e8d8a5c934ce7a9f93e3f8eff51665 (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.el | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -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))) |
