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

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

[elpa] externals/vertico a2e9b1b9b0 2/2: vertico-exit: Allow null comple


From: ELPA Syncer
Subject: [elpa] externals/vertico a2e9b1b9b0 2/2: vertico-exit: Allow null completion only if explicitly requested
Date: Sun, 7 Aug 2022 17:58:02 -0400 (EDT)

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

    vertico-exit: Allow null completion only if explicitly requested
    
    This change prevents premature exits with RET as long as Vertico is not yet
    initialized. As soon as Vertico is initialized the first candidate will be
    selected if REQUIRE-MATCH is non-nil.
---
 vertico.el | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/vertico.el b/vertico.el
index 878de3ef70..fe16dc73af 100644
--- a/vertico.el
+++ b/vertico.el
@@ -658,9 +658,7 @@ The function is configured by BY, BSIZE, BINDEX, BPRED and 
PRED."
 (defun vertico--match-p (input)
   "Return t if INPUT is a valid match."
   (or (memq minibuffer--require-match '(nil confirm-after-completion))
-      (equal "" input) ;; The questionable null completion
-      (test-completion input
-                       minibuffer-completion-table
+      (test-completion input minibuffer-completion-table
                        minibuffer-completion-predicate)
       (if (eq minibuffer--require-match 'confirm)
           (eq (ignore-errors (read-char "Confirm")) 13)
@@ -671,8 +669,10 @@ The function is configured by BY, BSIZE, BINDEX, BPRED and 
PRED."
   (interactive "P")
   (when (and (not arg) (>= vertico--index 0))
     (vertico-insert))
-  (when (vertico--match-p (minibuffer-contents-no-properties))
-    (exit-minibuffer)))
+  (let ((input (minibuffer-contents-no-properties)))
+    ;; Allow null completion only if explicitly requested (M-RET)
+    (when (or (and arg (equal input "")) (vertico--match-p input))
+      (exit-minibuffer))))
 
 (defun vertico-next-group (&optional n)
   "Cycle N groups forward.



reply via email to

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