branch: externals/ivy-hydra
commit 3ecf8281c1612eab4204976926ef1ae950bc331d
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
ivy.el (ivy-switch-buffer): Don't lose the current index
When e.g. candidate number 1 is selected, on more input that matches
this candidate, keep it selected, instead of selecting candidate 0 as
before.
Fixes #1500
Fixes #2648
---
ivy.el | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/ivy.el b/ivy.el
index 26e20ae..556a227 100644
--- a/ivy.el
+++ b/ivy.el
@@ -3676,8 +3676,9 @@ CANDS are the current candidates."
cands
:test #'ivy--case-fold-string=)))
((and (eq caller 'ivy-switch-buffer)
- (not empty)
- 0))
+ (not empty))
+ (or (cl-position current cands :test #'string=)
+ 0))
((and (not empty)
(not (eq caller 'swiper))
(not (and ivy--flx-featurep