Escape pipes in selection for rg project searches
Pipes need to be double-escaped, because they're meaningful to both ivy and ripgrep, and searches conducted on a selection need to be literal.
This commit is contained in:
parent
6be401f1a7
commit
76143d5a51
1 changed files with 8 additions and 5 deletions
|
@ -340,11 +340,14 @@ order.
|
||||||
(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)))
|
||||||
;; Escape characters that are special to ivy searches
|
;; Escape characters that are special to ivy searches
|
||||||
(replace-regexp-in-string "[! ]" (lambda (substr)
|
(replace-regexp-in-string "[! |]" (lambda (substr)
|
||||||
(if (and (featurep! +fuzzy)
|
(cond ((and (featurep! +fuzzy)
|
||||||
(string= substr " "))
|
(string= substr " "))
|
||||||
" "
|
" ")
|
||||||
(concat "\\\\" substr)))
|
((and (string= substr "|")
|
||||||
|
(eq engine 'rg))
|
||||||
|
"\\\\\\\\|")
|
||||||
|
((concat "\\\\" substr))))
|
||||||
(regexp-quote query))))))))
|
(regexp-quote query))))))))
|
||||||
(prompt
|
(prompt
|
||||||
(format "%s%%s %s"
|
(format "%s%%s %s"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue