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

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

[elpa] externals/vertico 34197f3 1/3: vertico--format-candidates: Cleanu


From: ELPA Syncer
Subject: [elpa] externals/vertico 34197f3 1/3: vertico--format-candidates: Cleanup
Date: Sun, 11 Jul 2021 00:57:17 -0400 (EDT)

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

    vertico--format-candidates: Cleanup
---
 vertico.el | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/vertico.el b/vertico.el
index 49922e6..2d4492b 100644
--- a/vertico.el
+++ b/vertico.el
@@ -435,18 +435,18 @@ See `resize-mini-windows' for documentation."
 
 (defun vertico--format-candidates (metadata)
   "Format current candidates with METADATA."
-  (let* ((group-fun (completion-metadata-get metadata 'group-function))
-         (group-format (and group-fun vertico-group-format (concat 
vertico-group-format "\n")))
-         (start (min (max 0 (- vertico--index (/ vertico-count 2) (if 
group-format -1 0)))
-                     (max 0 (- vertico--total vertico-count))))
-         (candidates
-          (thread-last (seq-subseq vertico--candidates start
-                                   (min (+ start vertico-count) 
vertico--total))
-            (funcall vertico--highlight)
-            (vertico--affixate metadata)))
-         (curr-line 0) (lines))
+  (let ((curr-line 0) (lines))
     ;; Compute group titles
-    (let ((index start) (title))
+    (let* ((start (min (max 0 (- vertico--index (/ vertico-count 2) (1- (mod 
vertico-count 2))))
+                       (max 0 (- vertico--total vertico-count))))
+           (index start) (title)
+           (group-fun (completion-metadata-get metadata 'group-function))
+           (group-format (and group-fun vertico-group-format (concat 
vertico-group-format "\n")))
+           (candidates
+            (thread-last (seq-subseq vertico--candidates start
+                                     (min (+ start vertico-count) 
vertico--total))
+              (funcall vertico--highlight)
+              (vertico--affixate metadata))))
       (dolist (cand candidates)
         (when-let (new-title (and group-format (funcall group-fun (car cand) 
nil)))
           (unless (equal title new-title)



reply via email to

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