* 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
(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