branch: master
commit d0f38267e2091e8152fda690e83fa35719201a10
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
ivy.el (ivy--preselect-index): Give priority to perfect match
---
ivy.el | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/ivy.el b/ivy.el
index 50704f6..d52b4b9 100644
--- a/ivy.el
+++ b/ivy.el
@@ -445,10 +445,11 @@ Turning on Ivy mode will set `completing-read-function' to
(lambda (x)
(string-match initial-input x))
candidates)))
- (cl-position-if
- (lambda (x)
- (string-match preselect x))
- candidates))
+ (or (cl-position preselect candidates :test 'equal)
+ (cl-position-if
+ (lambda (x)
+ (string-match preselect x))
+ candidates)))
;;* Implementation
;;** Regex