diff options
| author | Eivind Fonn <evfonn@gmail.com> | 2019-12-19 13:49:29 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-12-19 13:49:29 +0100 |
| commit | c95049a2ca471fc7bdc0cb14f11b482f3e20e834 (patch) | |
| tree | 4c79a43aa15d6b9c6ca664ce5bc2040e96871c52 | |
| parent | 8bfa17b77b63c52d603a1093375c3ab40fb2c430 (diff) | |
| parent | e47db185aa3e6a15eba6e34847f0b28aa7055db8 (diff) | |
Merge pull request #1221 from TheBB/wrap-search-bound
Fix bounds of wrapped search
| -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 000b8e3..58b6023 100644 --- a/evil-search.el +++ b/evil-search.el @@ -191,10 +191,16 @@ of the buffer." result) (setq result (funcall search-fun string bound ,(if wrap t 'noerror) count)) - (when (and ,wrap (null result)) + ;; Wrap the search only if a result was not found, and a bound not set + (when (and ,wrap (null result) (null bound)) (goto-char ,(if forward '(point-min) '(point-max))) (unwind-protect - (setq result (funcall search-fun string bound noerror count)) + ;; The wrapped search is bounded by the original starting point + (setq result (funcall search-fun string + ,(if forward + '(max (point-min) (1- start)) + '(min (point-max) (1+ start))) + noerror count)) (unless result (goto-char start)))) result))) |
