branch: master commit bcb81dde6e1abba02256d716426797a3e1b306f1 Author: Oleh Krehel <ohwoeo...@gmail.com> Commit: Oleh Krehel <ohwoeo...@gmail.com>
Fix swiper "backward" search * ivy.el (ivy-recompute-index-swiper): When none of the previous candidates after the point match the current input, instead of returning 0, return the index of the last matching candidate. This is a good choice, because that candidate is the closest to the point of the initial search start. Fixes #319 --- ivy.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ivy.el b/ivy.el index e65635d..bb2aa99 100644 --- a/ivy.el +++ b/ivy.el @@ -1998,7 +1998,9 @@ Prefix matches to NAME are put ahead of the list." (while (and tail (null idx)) ;; Compare with eq to handle equal duplicates in cands (setq idx (cl-position (pop tail) cands))) - (or idx 0)) + (or + idx + (1- (length cands)))) (if ivy--old-cands ivy--index ;; already in ivy-state-buffer