completion/ivy: use region is active & fix regex quoting

Fixes #1930
This commit is contained in:
Henrik Lissner 2019-10-22 11:27:07 -04:00
parent 6e6672b135
commit f79d191701
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 12 additions and 6 deletions

View file

@ -366,14 +366,14 @@ order.
(let ((query (buffer-substring-no-properties beg end)))
;; Escape characters that are special to ivy searches
(replace-regexp-in-string "[! |]" (lambda (substr)
(cond ((and (featurep! +fuzzy)
(string= substr " "))
(cond ((and (string= substr " ")
(not (featurep! +fuzzy)))
" ")
((and (string= substr "|")
(eq engine 'rg))
"\\\\\\\\|")
((concat "\\\\" substr))))
(regexp-quote query))))))))
(rxt-quote-pcre query))))))))
(prompt
(format "%s%%s %s"
(symbol-name engine)