emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/ivy-hydra 2b26f83 289/395: counsel.el (counsel--sync-se


From: Basil L. Contovounesios
Subject: [elpa] externals/ivy-hydra 2b26f83 289/395: counsel.el (counsel--sync-sentinel-on-exit): Don't reset index
Date: Thu, 25 Feb 2021 08:32:22 -0500 (EST)

branch: externals/ivy-hydra
commit 2b26f8371f981ce941d28e0dc5834e0b8befe96d
Author: Oleh Krehel <ohwoeowho@gmail.com>
Commit: Oleh Krehel <ohwoeowho@gmail.com>

    counsel.el (counsel--sync-sentinel-on-exit): Don't reset index
    
    If it was changed while we were waiting for output to finish.
    
    Fixes #2477
---
 counsel.el | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/counsel.el b/counsel.el
index 5e0b6f8..d0d94eb 100644
--- a/counsel.el
+++ b/counsel.el
@@ -250,15 +250,16 @@ respectively."
               (if (eq (ivy-alist-setting ivy-index-functions-alist) 
'ivy-recompute-index-zero)
                   (ivy-set-index 0)
                 (ivy--recompute-index re ivy--all-candidates))
-            (ivy-set-index
-             (let ((func (ivy-alist-setting ivy-index-functions-alist)))
-               (if func
-                   (funcall func re ivy--all-candidates)
-                 (ivy--preselect-index
-                  (if (> (length re) 0)
-                      cur
-                    (ivy-state-preselect ivy-last))
-                  ivy--all-candidates))))))
+            ;; index was changed before a long-running query exited
+            (unless (string= cur (nth ivy--index ivy--all-candidates))
+              (let ((func (ivy-alist-setting ivy-index-functions-alist)))
+                (if func
+                    (funcall func re ivy--all-candidates)
+                  (ivy--preselect-index
+                   (if (> (length re) 0)
+                       cur
+                     (ivy-state-preselect ivy-last))
+                   ivy--all-candidates))))))
         (setq ivy--old-cands ivy--all-candidates)
         (if ivy--all-candidates
             (ivy--exhibit)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]