emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/consult afb0bc5: Improve grep candidate formatting


From: ELPA Syncer
Subject: [elpa] externals/consult afb0bc5: Improve grep candidate formatting
Date: Thu, 11 Nov 2021 03:57:11 -0500 (EST)

branch: externals/consult
commit afb0bc5b3d264ee1fdc1bc7ec41ad169483eb29d
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@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))))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]