From b2d2b822cf4034e09c0c8a7ae02730347486786c Mon Sep 17 00:00:00 2001 From: Oleh Krehel Date: Sat, 26 Mar 2016 17:15:49 +0100 Subject: [PATCH] counsel.el (counsel-grep-action): Improve cleanup When the current input goes from matching to non-matching, ensure that the old overlays are cleaned up. --- counsel.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/counsel.el b/counsel.el index e9b706b5a..9384262aa 100644 --- a/counsel.el +++ b/counsel.el @@ -1361,8 +1361,9 @@ This uses `counsel-ag' with `counsel-pt-base-command' replacing nil))) (defun counsel-grep-action (x) - (when (string-match "\\`\\([0-9]+\\):\\(.*\\)\\'" x) - (with-ivy-window + (with-ivy-window + (swiper--cleanup) + (when (string-match "\\`\\([0-9]+\\):\\(.*\\)\\'" x) (let ((file-name counsel--git-grep-dir) (line-number (match-string-no-properties 1 x))) (find-file file-name) @@ -1372,7 +1373,6 @@ This uses `counsel-ag' with `counsel-pt-base-command' replacing (if (eq ivy-exit 'done) (swiper--ensure-visible) (unless (eq ivy-exit 'done) - (swiper--cleanup) (isearch-range-invisible (line-beginning-position) (line-end-position)) (swiper--add-overlays (ivy--regex ivy-text)))))))) -- 2.39.2