From 6f3c1c6d0061750ff09a907b442a6769184d036d Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 13 Jun 2019 09:35:09 +0200 Subject: [PATCH] Fix how project search escapes spaces #1487 When invoking project search (via SPC / p) with an active selection. --- modules/completion/ivy/autoload/ivy.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/completion/ivy/autoload/ivy.el b/modules/completion/ivy/autoload/ivy.el index 12ed7b86d..6e666327c 100644 --- a/modules/completion/ivy/autoload/ivy.el +++ b/modules/completion/ivy/autoload/ivy.el @@ -339,8 +339,13 @@ order. (end (or (bound-and-true-p evil-visual-end) (region-end)))) (when (> (abs (- end beg)) 1) (let ((query (buffer-substring-no-properties beg end))) - (replace-regexp-in-string "!" "\\!" (regexp-quote query) - nil t))))))) + ;; Escape characters that are special to ivy searches + (replace-regexp-in-string "[! ]" (lambda (substr) + (if (and (featurep! +fuzzy) + (string= substr " ")) + " " + (concat "\\\\" substr))) + (regexp-quote query)))))))) (prompt (format "%s%%s %s" (symbol-name engine)