branch: master
commit 7d909e7837728294de13cfee88389fb2582c747d
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
Add work-around for DEF not being in COLLECTION for `completing-read'
* ivy.el (ivy-read): Update.
---
ivy.el | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/ivy.el b/ivy.el
index 390af9c..ac631f6 100644
--- a/ivy.el
+++ b/ivy.el
@@ -238,6 +238,10 @@ UPDATE-FN is called each time the current candidate(s) is
changed."
(error "Hash table as a collection unsupported"))
((listp (car collection))
(setq collection (all-completions "" collection predicate))))
+ (when preselect
+ (unless (or ivy-require-match
+ (all-completions preselect collection))
+ (setq collection (cons preselect collection))))
(cl-case (length collection)
(0 nil)
(1 (car collection))