branch: master
commit 5d2938f4a43d4f7290c80d77a756f971efd6160c
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
counsel.el (counsel-git-grep): Works with ivy--regex-fuzzy
`ivy-occur' works as well.
Fixes #2243
---
counsel.el | 9 ++++++++-
ivy.el | 2 +-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/counsel.el b/counsel.el
index b313d86..061a85c 100644
--- a/counsel.el
+++ b/counsel.el
@@ -1356,7 +1356,11 @@ Typical value: '(recenter)."
(defun counsel-git-grep-cmd-function-default (str)
(format counsel-git-grep-cmd
- (setq ivy--old-re (ivy--regex str t))))
+ (setq ivy--old-re
+ (if (eq ivy--regex-function #'ivy--regex-fuzzy)
+ (replace-regexp-in-string
+ "\n" "" (ivy--regex-fuzzy str))
+ (ivy--regex str t)))))
(defun counsel-git-grep-cmd-function-ignore-order (str)
(setq ivy--old-re (ivy--regex str t))
@@ -1543,6 +1547,9 @@ When CMD is non-nil, prompt for a specific \"git grep\"
command."
(defun counsel--git-grep-occur-cmd (input)
(let* ((regex (funcall ivy--regex-function input))
+ (regex (if (eq ivy--regex-function #'ivy--regex-fuzzy)
+ (replace-regexp-in-string "\n" "" regex)
+ regex))
(positive-pattern (replace-regexp-in-string
;; git-grep can't handle .*?
"\\.\\*\\?" ".*"
diff --git a/ivy.el b/ivy.el
index 9bb5cad..05d8803 100644
--- a/ivy.el
+++ b/ivy.el
@@ -2465,7 +2465,7 @@ See `completion-in-region' for further information."
(string= str (car comps))))
(message "Sole match"))
(t
- (when (eq collection #'crm--collection-fn)
+ (when (eq collection 'crm--collection-fn)
(setq comps (delete-dups comps)))
(let* ((len (ivy-completion-common-length (car comps)))
(initial (cond ((= len 0)