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

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

[elpa] externals/vertico 7c065ac5ca: vertico--candidate: Return default


From: ELPA Syncer
Subject: [elpa] externals/vertico 7c065ac5ca: vertico--candidate: Return default value if the input is empty
Date: Mon, 3 Jan 2022 06:57:40 -0500 (EST)

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

    vertico--candidate: Return default value if the input is empty
---
 vertico.el | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/vertico.el b/vertico.el
index 526fb2e144..354e58a2f2 100644
--- a/vertico.el
+++ b/vertico.el
@@ -732,17 +732,18 @@ When the prefix argument is 0, the group order is reset."
 (defun vertico--candidate (&optional hl)
   "Return current candidate string with optional highlighting if HL is 
non-nil."
   (let ((content (substring (or (car-safe vertico--input) 
(minibuffer-contents)))))
-    (if (>= vertico--index 0)
-        (let ((cand (substring (nth vertico--index vertico--candidates))))
-          ;;; XXX Drop the completions-common-part face which is added by 
`completion--twq-all'.
-          ;; This is a hack in Emacs and should better be fixed in Emacs 
itself, the corresponding
-          ;; code is already marked with a FIXME. Should this be reported as a 
bug?
-          (vertico--remove-face 0 (length cand) 'completions-common-part cand)
-          (concat (substring content 0 vertico--base)
-                  (if hl (car (funcall vertico--highlight-function (list 
cand))) cand)))
-      ;; Remove prompt face
-      (vertico--remove-face 0 (length content) 'vertico-current content)
-      content)))
+    (cond
+     ((>= vertico--index 0)
+      (let ((cand (substring (nth vertico--index vertico--candidates))))
+        ;; XXX Drop the completions-common-part face which is added by 
`completion--twq-all'.
+        ;; This is a hack in Emacs and should better be fixed in Emacs itself, 
the corresponding
+        ;; code is already marked with a FIXME. Should this be reported as a 
bug?
+        (vertico--remove-face 0 (length cand) 'completions-common-part cand)
+        (concat (substring content 0 vertico--base)
+                (if hl (car (funcall vertico--highlight-function (list cand))) 
cand))))
+     ((and (equal content "") (or (car-safe minibuffer-default) 
minibuffer-default)))
+     (t (vertico--remove-face 0 (length content) 'vertico-current content) ;; 
Remove prompt face
+        content))))
 
 (defun vertico--setup ()
   "Setup completion UI."



reply via email to

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