branch: master commit be989fe5aa9db153931ec61f1ff2940650ec6563 Author: Oleh Krehel <ohwoeo...@gmail.com> Commit: Oleh Krehel <ohwoeo...@gmail.com>
Preselect perfect matches with a leading ^ * ivy.el (ivy--filter): When e.g. "filter" is in the collection, "^filter" input should always select it, even if other candidates match. --- ivy.el | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ivy.el b/ivy.el index faa469b..21197c3 100644 --- a/ivy.el +++ b/ivy.el @@ -1415,8 +1415,11 @@ CANDIDATES are assumed to be static." (unless (and (not (equal re ivy--old-re)) (or (setq ivy--index (or - (cl-position re cands - :test #'equal) + (cl-position (if (and (> (length re) 0) + (eq ?^ (aref re 0))) + (substring re 1) + re) cands + :test #'equal) (and ivy--directory (cl-position (concat re "/") cands