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

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

[elpa] externals/vertico cc5f5421c6: vertico-insert: Insert single candi


From: ELPA Syncer
Subject: [elpa] externals/vertico cc5f5421c6: vertico-insert: Insert single candidate even if not selected (Fix #225)
Date: Fri, 6 May 2022 17:58:10 -0400 (EDT)

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

    vertico-insert: Insert single candidate even if not selected (Fix #225)
---
 vertico.el | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/vertico.el b/vertico.el
index c5de0ef4a5..526420f502 100644
--- a/vertico.el
+++ b/vertico.el
@@ -716,15 +716,14 @@ When the prefix argument is 0, the group order is reset."
 (defun vertico-insert ()
   "Insert current candidate in minibuffer."
   (interactive)
-  ;; XXX There is a small bug here, depending on interpretation. When
-  ;; completing "~/emacs/master/li|/calc" where "|" is the cursor,
-  ;; then the returned candidate only includes the prefix
-  ;; "~/emacs/master/lisp/", but not the suffix "/calc". Default
-  ;; completion has the same problem when selecting in the
-  ;; *Completions* buffer. See bug#48356.
-  (when-let (cand (and (>= vertico--index 0) (vertico--candidate)))
-    (delete-minibuffer-contents)
-    (insert cand)))
+  ;; XXX There is a small bug here, depending on interpretation. When 
completing
+  ;; "~/emacs/master/li|/calc" where "|" is the cursor, then the returned
+  ;; candidate only includes the prefix "~/emacs/master/lisp/", but not the
+  ;; suffix "/calc". Default completion has the same problem when selecting in
+  ;; the *Completions* buffer. See bug#48356.
+  (when (or (>= vertico--index 0) (= vertico--total 1))
+    (let ((vertico--index (max 0 vertico--index)))
+      (insert (prog1 (vertico--candidate) (delete-minibuffer-contents))))))
 
 (defun vertico--candidate (&optional hl)
   "Return current candidate string with optional highlighting if HL is 
non-nil."



reply via email to

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