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

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

[elpa] externals/vertico 32706ac: Restore group title highlighting (Fix


From: ELPA Syncer
Subject: [elpa] externals/vertico 32706ac: Restore group title highlighting (Fix #39)
Date: Wed, 21 Jul 2021 10:57:16 -0400 (EDT)

branch: externals/vertico
commit 32706ace5c118b3ed0c6b40fdd6dee19a5c62708
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    Restore group title highlighting (Fix #39)
    
    The highlighting works only when the title is a prefix of the candidate, but
    this is the common case.
---
 vertico.el | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/vertico.el b/vertico.el
index 0dc461f..cb253d0 100644
--- a/vertico.el
+++ b/vertico.el
@@ -474,10 +474,16 @@ The function is configured by BY, BSIZE, BINDEX, BPRED 
and PRED."
               (funcall vertico--highlight-function)
               (vertico--affixate metadata))))
       (dolist (cand candidates)
-        (when-let (new-title (and group-format (funcall group-fun (car cand) 
nil)))
-          (unless (equal title new-title)
-            (push (format group-format (setq title new-title)) lines))
-          (setcar cand (funcall group-fun (car cand) 'transform)))
+        (let ((str (car cand)))
+          (when-let (new-title (and group-format (funcall group-fun str nil)))
+            (unless (equal title new-title)
+              (setq title new-title)
+              ;; Restore group title highlighting for prefix titles
+              (when (string-prefix-p title str)
+                (setq title (substring str 0 (length title)))
+                (vertico--remove-face 0 (length title) 
'completions-first-difference title))
+              (push (format group-format title) lines))
+            (setcar cand (funcall group-fun str 'transform))))
         (when (= index vertico--index)
           (setq curr-line (length lines)))
         (push (cons index cand) lines)



reply via email to

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