branch: master
commit 3be5e7846b205e016bac03e4178c6b710511d8ce
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
counsel.el (counsel-git-grep-action): Check re-search-forward
Re #2209
---
counsel.el | 12 ++++++------
swiper.el | 1 +
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/counsel.el b/counsel.el
index 5c94bcb..b534541 100644
--- a/counsel.el
+++ b/counsel.el
@@ -1371,9 +1371,9 @@ Typical value: '(recenter)."
(ivy-state-directory ivy-last)))
(goto-char (point-min))
(forward-line (1- (string-to-number line-number)))
- (re-search-forward (ivy--regex ivy-text t) (line-end-position) t)
- (when swiper-goto-start-of-match
- (goto-char (match-beginning 0)))
+ (when (re-search-forward (ivy--regex ivy-text t) (line-end-position) t)
+ (when swiper-goto-start-of-match
+ (goto-char (match-beginning 0))))
(swiper--ensure-visible)
(run-hooks 'counsel-grep-post-action-hook)
(unless (eq ivy-exit 'done)
@@ -2986,9 +2986,9 @@ substituted by the search regexp and file, respectively.
Neither
(goto-char (point-min))
(forward-line (1- line-number)))
(setq counsel-grep-last-line line-number)
- (re-search-forward (ivy--regex ivy-text t) (line-end-position) t)
- (when swiper-goto-start-of-match
- (goto-char (match-beginning 0)))
+ (when (re-search-forward (ivy--regex ivy-text t) (line-end-position)
t)
+ (when swiper-goto-start-of-match
+ (goto-char (match-beginning 0))))
(run-hooks 'counsel-grep-post-action-hook)
(if (eq ivy-exit 'done)
(swiper--ensure-visible)
diff --git a/swiper.el b/swiper.el
index 2766485..5e73ba4 100644
--- a/swiper.el
+++ b/swiper.el
@@ -1585,6 +1585,7 @@ When not running `swiper-isearch' already, start it."
(unless (or res swiper-stay-on-quit)
(goto-char swiper--opoint))
(isearch-clean-overlays)
+ (swiper--ensure-visible)
(unless (or res (string= ivy-text ""))
(cl-pushnew ivy-text swiper-history)))))