aboutsummaryrefslogtreecommitdiff
path: root/evil-search.el
diff options
context:
space:
mode:
authorEivind Fonn <evfonn@gmail.com>2019-12-19 13:42:23 +0100
committerEivind Fonn <evfonn@gmail.com>2019-12-19 13:42:23 +0100
commite47db185aa3e6a15eba6e34847f0b28aa7055db8 (patch)
tree4c79a43aa15d6b9c6ca664ce5bc2040e96871c52 /evil-search.el
parent8bfa17b77b63c52d603a1093375c3ab40fb2c430 (diff)
Fix bounds of wrapped search
Do not perform the second search if the original search bound was set, as it must necessarily be bypassed. Use the original starting point for the search as the bound for the second search. Fixes #843 Thanks to Miciah Dashiel Butler Masters
Diffstat (limited to 'evil-search.el')
-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)))