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

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

[elpa] externals/vertico 6f6d345 02/10: vertico--recompute-candidates: M


From: Protesilaos Stavrou
Subject: [elpa] externals/vertico 6f6d345 02/10: vertico--recompute-candidates: Move directory to the top if it matches input
Date: Fri, 9 Apr 2021 10:48:28 -0400 (EDT)

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

    vertico--recompute-candidates: Move directory to the top if it matches input
---
 vertico.el | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/vertico.el b/vertico.el
index 4d8e2bb..03a2831 100644
--- a/vertico.el
+++ b/vertico.el
@@ -255,15 +255,19 @@
                    (prog1 (cdr last)
                      (setcdr last nil))
                  0))
+         (iab (vertico--input-after-boundary input))
          (def (or (car-safe minibuffer-default) minibuffer-default))
          (total (length all)))
     (when (<= total vertico-sort-threshold)
       (setq all (if-let (sort (completion-metadata-get metadata 
'display-sort-function))
                     (funcall sort all)
                   (vertico--sort input all))))
+    ;; Move special candidates: "input" appears at the top, before "input/", 
before default value
     (when (stringp def)
       (setq all (vertico--move-to-front def all)))
-    (setq all (vertico--move-to-front (vertico--input-after-boundary input) 
all))
+    (when (and minibuffer-completing-file-name (not (string-suffix-p "/" iab)))
+      (setq all (vertico--move-to-front (concat iab "/") all)))
+    (setq all (vertico--move-to-front iab all))
     (when-let (group (completion-metadata-get metadata 'x-group-function))
       (setq all (mapcan #'cdr (funcall group all))))
     (list base total all)))
@@ -453,7 +457,7 @@
   (unless arg (vertico-insert))
   (let ((input (minibuffer-contents-no-properties)))
     (if (or (memq minibuffer--require-match '(nil confirm-after-completion))
-            (equal "" input)
+            (equal "" input) ;; The questionable null completion
             (test-completion input
                              minibuffer-completion-table
                              minibuffer-completion-predicate)



reply via email to

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