branch: externals/consult commit afb0bc5b3d264ee1fdc1bc7ec41ad169483eb29d Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Daniel Mendler <m...@daniel-mendler.de>
Improve grep candidate formatting --- consult.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/consult.el b/consult.el index fd0bf7c..1a30459 100644 --- a/consult.el +++ b/consult.el @@ -4095,6 +4095,7 @@ BUILDER is the command argument builder." (let* ((file (match-string 1 str)) (line (match-string 2 str)) (ctx (= (aref str (match-beginning 3)) ?-)) + (sep (if ctx "-" ":")) (content (substring str (match-end 0))) (file-len (length file)) (line-len (length line))) @@ -4102,12 +4103,12 @@ BUILDER is the command argument builder." (setq content (substring content 0 consult-grep-max-columns))) (when highlight (funcall highlight content)) - (setq str (concat file ":" line (if ctx "-" ":") content)) + (setq str (concat file sep line sep content)) ;; Store file name in order to avoid allocations in `consult--grep-group' (add-text-properties 0 file-len `(face consult-file consult--grep-file ,file) str) (put-text-property (1+ file-len) (+ 1 file-len line-len) 'face 'consult-line-number str) (when ctx - (add-face-text-property (+ 1 file-len line-len) (length str) 'consult-grep-context 'append str)) + (add-face-text-property (+ 2 file-len line-len) (length str) 'consult-grep-context 'append str)) (push str result))))) (funcall async (nreverse result)))) (t (funcall async action))))))