emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 73d9f4a 083/184: Place cursor at the begging of matches (f


From: Oleh Krehel
Subject: [elpa] master 73d9f4a 083/184: Place cursor at the begging of matches (for grep)
Date: Wed, 16 Oct 2019 13:14:53 -0400 (EDT)

branch: master
commit 73d9f4a4f40c08aba4c442bf2093a306f016a367
Author: Campbell Barton <address@hidden>
Commit: Oleh Krehel <address@hidden>

    Place cursor at the begging of matches (for grep)
    
    The cursor was being placed after the matches, adding an extra step if
    you need to operate on the word, after opening the file with a match.
    
    Fixes #2209
---
 counsel.el | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/counsel.el b/counsel.el
index 038bb8b..5c94bcb 100644
--- a/counsel.el
+++ b/counsel.el
@@ -1372,6 +1372,8 @@ Typical value: '(recenter)."
       (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)))
       (swiper--ensure-visible)
       (run-hooks 'counsel-grep-post-action-hook)
       (unless (eq ivy-exit 'done)
@@ -2985,6 +2987,8 @@ substituted by the search regexp and file, respectively.  
Neither
             (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)))
           (run-hooks 'counsel-grep-post-action-hook)
           (if (eq ivy-exit 'done)
               (swiper--ensure-visible)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]