mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
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:
@ -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"
|
||||||
|
Reference in New Issue
Block a user