Fix how project search escapes regexps #1486

When invoking project search (via SPC / p) with an active selection, the
selection is captured and escaped, but was escaped incorrectly.
This commit is contained in:
Henrik Lissner 2019-06-12 20:08:16 +02:00
parent b2da28edfe
commit 4ef345fe50
No known key found for this signature in database
GPG Key ID: 5F6C0EA160557395

View File

@ -333,12 +333,14 @@ order.
'grep)
(error "No search engine specified (is ag, rg, pt or git installed?)")))
(query
(or (if query (rxt-quote-pcre query))
(or (if query query)
(when (use-region-p)
(let ((beg (or (bound-and-true-p evil-visual-beginning) (region-beginning)))
(end (or (bound-and-true-p evil-visual-end) (region-end))))
(when (> (abs (- end beg)) 1)
(rxt-quote-pcre (buffer-substring-no-properties beg end)))))))
(let ((query (buffer-substring-no-properties beg end)))
(replace-regexp-in-string "!" "\\!" (regexp-quote query)
nil t)))))))
(prompt
(format "%s%%s %s"
(symbol-name engine)