aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEivind Fonn <evfonn@gmail.com>2019-12-19 13:49:29 +0100
committerGitHub <noreply@github.com>2019-12-19 13:49:29 +0100
commitc95049a2ca471fc7bdc0cb14f11b482f3e20e834 (patch)
tree4c79a43aa15d6b9c6ca664ce5bc2040e96871c52
parent8bfa17b77b63c52d603a1093375c3ab40fb2c430 (diff)
parente47db185aa3e6a15eba6e34847f0b28aa7055db8 (diff)
Merge pull request #1221 from TheBB/wrap-search-bound
Fix bounds of wrapped search
-rw-r--r--evil-search.el10
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)))