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

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

[elpa] externals/vertico 32e0206949 1/2: vertico-grid: Use cl-loop


From: ELPA Syncer
Subject: [elpa] externals/vertico 32e0206949 1/2: vertico-grid: Use cl-loop
Date: Wed, 8 Nov 2023 15:58:50 -0500 (EST)

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

    vertico-grid: Use cl-loop
---
 extensions/vertico-grid.el | 35 +++++++++++++++++------------------
 1 file changed, 17 insertions(+), 18 deletions(-)

diff --git a/extensions/vertico-grid.el b/extensions/vertico-grid.el
index 70fe0d9f82..1a8d09e986 100644
--- a/extensions/vertico-grid.el
+++ b/extensions/vertico-grid.el
@@ -130,24 +130,23 @@ When scrolling beyond this limit, candidates may be 
truncated."
          (count (* vertico-count vertico-grid--columns))
          (start (* count (floor (max 0 vertico--index) count)))
          (width (- (/ (vertico--window-width) vertico-grid--columns) sep))
-         (cands
-          (seq-map-indexed
-           (lambda (cand index)
-             (let (prefix suffix)
-               (when (consp cand)
-                 (setq prefix (cadr cand) suffix (caddr cand) cand (car cand)))
-               (when (string-search "\n" cand)
-                 (setq cand (vertico--truncate-multiline cand width)))
-               (truncate-string-to-width
-                (string-trim
-                 (replace-regexp-in-string
-                  "[ \t]+"
-                  (lambda (x) (apply #'propertize " " (text-properties-at 0 
x)))
-                  (vertico--format-candidate cand prefix suffix (+ index 
start) start)))
-                width)))
-           (funcall (if (> vertico-grid-annotate 0) #'vertico--affixate 
#'identity)
-                    (cl-loop repeat count for c in (nthcdr start 
vertico--candidates)
-                             collect (funcall vertico--hilit (substring c))))))
+         (cands (funcall (if (> vertico-grid-annotate 0) #'vertico--affixate 
#'identity)
+                         (cl-loop repeat count for c in (nthcdr start 
vertico--candidates)
+                                  collect (funcall vertico--hilit (substring 
c)))))
+         (cands (cl-loop
+                 for cand in cands for index from 0 collect
+                 (let (prefix suffix)
+                   (when (consp cand)
+                     (setq prefix (cadr cand) suffix (caddr cand) cand (car 
cand)))
+                   (when (string-search "\n" cand)
+                     (setq cand (vertico--truncate-multiline cand width)))
+                   (truncate-string-to-width
+                    (string-trim
+                     (replace-regexp-in-string
+                      "[ \t]+"
+                      (lambda (x) (apply #'propertize " " (text-properties-at 
0 x)))
+                      (vertico--format-candidate cand prefix suffix (+ index 
start) start)))
+                    width))))
          (width (make-vector vertico-grid--columns 0)))
     (dotimes (col vertico-grid--columns)
       (dotimes (row vertico-count)



reply via email to

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