branch: master
commit f9e811600940978f469bbe422f5308616d337f6e
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
swiper.el (swiper-isearch-action): Fix outlines getting over-revealed
* swiper.el (swiper-isearch-action): The change to
`isearch-range-invisible' params is important here.
(swiper-isearch): Clean up the overlays here, instead of in
`swiper--cleanup'.
Expected behavior after the fix: all outlines that were revealed are
closed, either on finish or on abort. The exception is the outline
that contains the point.
Fixes #2119
---
swiper.el | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/swiper.el b/swiper.el
index 7c645c2..70b0f55 100644
--- a/swiper.el
+++ b/swiper.el
@@ -679,6 +679,7 @@ When capture groups are present in the input, print them
instead of lines."
(bound-and-true-p reveal-mode))
(reveal-mode -1))
(lazy-highlight-cleanup t)
+ (setq isearch-opened-overlays nil)
(when (bound-and-true-p evil-mode)
(evil-set-jump)))
@@ -810,9 +811,6 @@ Matched candidates should have `swiper-invocation-face'."
;; force cleanup unless it's :unwind
(lazy-highlight-cleanup
(if (eq ivy-exit 'done) lazy-highlight-cleanup t))
- (save-excursion
- (goto-char (point-min))
- (isearch-clean-overlays))
(when (timerp swiper--isearch-highlight-timer)
(cancel-timer swiper--isearch-highlight-timer)
(setq swiper--isearch-highlight-timer nil)))
@@ -1338,8 +1336,7 @@ that we search only for one character."
(setq x (get-text-property 0 'point x))))
(with-ivy-window
(goto-char x)
- (isearch-range-invisible (line-beginning-position)
- (line-end-position))
+ (isearch-range-invisible (point) (1+ (point)))
(unless (eq ivy-exit 'done)
(swiper--cleanup)
(swiper--delayed-add-overlays)
@@ -1506,6 +1503,7 @@ When not running `swiper-isearch' already, start it."
(point))
(unless (or res swiper-stay-on-quit)
(goto-char swiper--opoint))
+ (isearch-clean-overlays)
(unless (or res (string= ivy-text ""))
(cl-pushnew ivy-text swiper-history)))))