branch: master commit f268cc8119431ff6caab882b6209b15cc2585108 Author: Oleh Krehel <ohwoeo...@gmail.com> Commit: Oleh Krehel <ohwoeo...@gmail.com>
Reveal invisible overlays * swiper.el (swiper--ivy): Update. (swiper--ensure-visible): New defun. (swiper--action): Update. Fixes #11. --- swiper.el | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/swiper.el b/swiper.el index 871082e..b4aa703 100644 --- a/swiper.el +++ b/swiper.el @@ -152,7 +152,8 @@ When non-nil, INITIAL-INPUT is the initial search pattern." (re-search-forward (ivy--regex ivy-text) (line-end-position) - t))))) + t) + (swiper--ensure-visible))))) (defun swiper--helm (&optional initial-input) "`isearch' with an overview using `helm'. @@ -197,6 +198,15 @@ When non-nil, INITIAL-INPUT is the initial search pattern." (remove-hook 'helm-after-update-hook #'swiper--reanchor) (swiper--cleanup))) +(defun swiper--ensure-visible () + "Remove overlays hiding point." + (let ((overlays (overlays-at (point))) + ov expose) + (while (setq ov (pop overlays)) + (if (and (invisible-p (overlay-get ov 'invisible)) + (setq expose (overlay-get ov 'isearch-open-invisible))) + (funcall expose ov))))) + (defun swiper--cleanup () "Clean up the overlays." (while swiper--overlays @@ -350,7 +360,8 @@ When non-nil, INITIAL-INPUT is the initial search pattern." (goto-char (point-min)) (forward-line (1- (read x))) (re-search-forward - (ivy--regex helm-input) (line-end-position) t)) + (ivy--regex helm-input) (line-end-position) t) + (swiper--ensure-visible)) (provide 'swiper)