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

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

[elpa] externals/vertico 9f1a671 3/3: vertico--recompute-candidates: Per


From: ELPA Syncer
Subject: [elpa] externals/vertico 9f1a671 3/3: vertico--recompute-candidates: Perform index computation
Date: Wed, 16 Jun 2021 18:57:17 -0400 (EDT)

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

    vertico--recompute-candidates: Perform index computation
---
 vertico.el | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/vertico.el b/vertico.el
index 0f742ef..4af6ae9 100644
--- a/vertico.el
+++ b/vertico.el
@@ -288,7 +288,14 @@
     (setq all (vertico--move-to-front field all))
     (when-let (group-fun (completion-metadata-get metadata 'group-function))
       (setq all (vertico--group-by group-fun all)))
-    (list base (length all) all hl)))
+    (list base
+          (length all)
+          ;; Find position of old candidate in the new list.
+          (when vertico--keep
+            (if (< vertico--index 0)
+                vertico--index
+              (seq-position all (nth vertico--index vertico--candidates))))
+          all hl)))
 
 (defun vertico--group-by (fun elems)
   "Group ELEMS by FUN."
@@ -325,15 +332,9 @@
               (non-essential t))
           (while-no-input (vertico--recompute-candidates pt content bounds 
metadata))))
     ('nil (abort-recursive-edit))
-    (`(,base ,total ,candidates ,hl)
-     ;; Find position of old candidate in the new list.
-     (unless (and vertico--keep (< vertico--index 0))
-       (let ((old (and candidates
-                       vertico--keep
-                       (>= vertico--index 0)
-                       (nth vertico--index vertico--candidates))))
-         (setq vertico--index (and old (seq-position candidates old)))))
+    (`(,base ,total ,index ,candidates ,hl)
      (setq vertico--input (cons content pt)
+           vertico--index index
            vertico--base base
            vertico--total total
            vertico--highlight hl



reply via email to

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