branch: master
commit ed61b04942318ac51da4bccb1c0ab78b6bc89f72
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
Fix problems introduced by "(ivy--filter): Recompute index after sort"
Use the old logic for 'ivy-recompute-index-swiper and
'ivy-recompute-index-swiper-async. Otherwise, swiper's re-anchoring
doesn't work any more.
Re #491
---
ivy.el | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/ivy.el b/ivy.el
index c583fce..fe7eeff 100644
--- a/ivy.el
+++ b/ivy.el
@@ -2168,15 +2168,21 @@ CANDIDATES are assumed to be static."
ivy--old-cands)))
(t
(ivy--re-filter re candidates)))))
- (prog1
- (setq ivy--old-cands (ivy--sort name cands))
- (ivy--recompute-index name re-str ivy--old-cands)
- (setq ivy--old-re
- (if (eq ivy--regex-function 'ivy--regex-ignore-order)
- re
- (if ivy--old-cands
- re-str
- ""))))))))
+ (if (memq (cdr (assoc (ivy-state-caller ivy-last)
ivy-index-functions-alist))
+ '(ivy-recompute-index-swiper
+ ivy-recompute-index-swiper-async))
+ (progn
+ (ivy--recompute-index name re-str cands)
+ (setq ivy--old-cands (ivy--sort name cands)))
+ (setq ivy--old-cands (ivy--sort name cands))
+ (ivy--recompute-index name re-str ivy--old-cands))
+ (setq ivy--old-re
+ (if (eq ivy--regex-function 'ivy--regex-ignore-order)
+ re
+ (if ivy--old-cands
+ re-str
+ "")))
+ ivy--old-cands))))
(defun ivy--set-candidates (x)
"Update `ivy--all-candidates' with X."