Fix how project search escapes spaces #1487

When invoking project search (via SPC / p) with an active selection.
This commit is contained in:
Henrik Lissner 2019-06-13 09:35:09 +02:00
parent c9305a552d
commit 6f3c1c6d00
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -339,8 +339,13 @@ order.
(end (or (bound-and-true-p evil-visual-end) (region-end)))) (end (or (bound-and-true-p evil-visual-end) (region-end))))
(when (> (abs (- end beg)) 1) (when (> (abs (- end beg)) 1)
(let ((query (buffer-substring-no-properties beg end))) (let ((query (buffer-substring-no-properties beg end)))
(replace-regexp-in-string "!" "\\!" (regexp-quote query) ;; Escape characters that are special to ivy searches
nil t))))))) (replace-regexp-in-string "[! ]" (lambda (substr)
(if (and (featurep! +fuzzy)
(string= substr " "))
" "
(concat "\\\\" substr)))
(regexp-quote query))))))))
(prompt (prompt
(format "%s%%s %s" (format "%s%%s %s"
(symbol-name engine) (symbol-name engine)