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:
parent
b2da28edfe
commit
4ef345fe50
1 changed files with 4 additions and 2 deletions
|
@ -333,12 +333,14 @@ order.
|
||||||
'grep)
|
'grep)
|
||||||
(error "No search engine specified (is ag, rg, pt or git installed?)")))
|
(error "No search engine specified (is ag, rg, pt or git installed?)")))
|
||||||
(query
|
(query
|
||||||
(or (if query (rxt-quote-pcre query))
|
(or (if query query)
|
||||||
(when (use-region-p)
|
(when (use-region-p)
|
||||||
(let ((beg (or (bound-and-true-p evil-visual-beginning) (region-beginning)))
|
(let ((beg (or (bound-and-true-p evil-visual-beginning) (region-beginning)))
|
||||||
(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)
|
||||||
(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
|
(prompt
|
||||||
(format "%s%%s %s"
|
(format "%s%%s %s"
|
||||||
(symbol-name engine)
|
(symbol-name engine)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue