branch: master
commit 79ffa6785895c25271baf9d2931a74c114ca8574
Author: justbur <[email protected]>
Commit: justbur <[email protected]>

    ivy.el (ivy--filter): Recompute index after sort
    
    Fixes #484
---
 ivy.el | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/ivy.el b/ivy.el
index 8e7016b..a1bda77 100644
--- a/ivy.el
+++ b/ivy.el
@@ -2148,14 +2148,15 @@ CANDIDATES are assumed to be static."
                           ivy--old-cands)))
                       (t
                        (ivy--re-filter re candidates)))))
-        (ivy--recompute-index name re-str cands)
-        (setq ivy--old-re
-              (if (eq ivy--regex-function 'ivy--regex-ignore-order)
-                  re
-                (if cands
-                    re-str
-                  "")))
-        (setq ivy--old-cands (ivy--sort name cands))))))
+        (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
+                    ""))))))))
 
 (defun ivy--set-candidates (x)
   "Update `ivy--all-candidates' with X."

Reply via email to