branch: master
commit 34161427f438c4c8fe9f118ff2361d5c6a08a488
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
counsel.el (counsel--async-sentinel): Fix index jumping randomly
Previously, if a function, e.g. `counsel-rg', had
`ivy-recompute-index-zero' associated, the index would not always
reset to 0. This should be fixed now.
TODO: simplify the logic here.
---
counsel.el | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/counsel.el b/counsel.el
index 8abc5f1..43200db 100644
--- a/counsel.el
+++ b/counsel.el
@@ -216,7 +216,9 @@ respectively."
(time-to-seconds (time-since counsel--async-start))))
(let ((re (ivy-re-to-str (funcall ivy--regex-function ivy-text))))
(if ivy--old-cands
- (ivy--recompute-index ivy-text re ivy--all-candidates)
+ (if (eq (ivy-alist-setting ivy-index-functions-alist)
'ivy-recompute-index-zero)
+ (ivy-set-index 0)
+ (ivy--recompute-index ivy-text re ivy--all-candidates))
(unless (ivy-set-index
(ivy--preselect-index
(ivy-state-preselect ivy-last)