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

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

[elpa] master f38bb51 161/399: ivy.el (ivy--prompt-selectable-p): Allow


From: Oleh Krehel
Subject: [elpa] master f38bb51 161/399: ivy.el (ivy--prompt-selectable-p): Allow to select ""
Date: Sat, 20 Jul 2019 14:57:15 -0400 (EDT)

branch: master
commit f38bb51163db02a3f665371f523c22ea4b502e79
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    ivy.el (ivy--prompt-selectable-p): Allow to select ""
    
    When :require-match is t, and "" is in the collection.
    
    Fixes #1924
---
 ivy.el | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/ivy.el b/ivy.el
index 07d271b..f814bc6 100644
--- a/ivy.el
+++ b/ivy.el
@@ -693,8 +693,14 @@ candidate, not the prompt."
 (defun ivy--prompt-selectable-p ()
   "Return t if the prompt line is selectable."
   (and ivy-use-selectable-prompt
-       (memq (ivy-state-require-match ivy-last)
-             '(nil confirm confirm-after-completion))))
+       (or (memq (ivy-state-require-match ivy-last)
+                 '(nil confirm confirm-after-completion))
+           ;; :require-match is t, but "" is in the collection
+           (let ((coll (ivy-state-collection ivy-last)))
+             (and (listp coll)
+                  (if (consp (car coll))
+                      (member '("") coll)
+                    (member "" coll)))))))
 
 (defun ivy--prompt-selected-p ()
   "Return t if the prompt line is selected."



reply via email to

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