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

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

[elpa] master b57c57d 153/167: Fix the preselect for (swiper "one") agai


From: Oleh Krehel
Subject: [elpa] master b57c57d 153/167: Fix the preselect for (swiper "one") again
Date: Tue, 08 Dec 2015 10:50:40 +0000

branch: master
commit b57c57de2831a8098a2d075c0174608fa1bc443b
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    Fix the preselect for (swiper "one") again
    
    * ivy.el (ivy--reset-state): Take into account :preselect being integer.
    This means that it's void once the candidates are filtered over
    :initial-input.
    
    Fixes #292
---
 ivy.el |   24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/ivy.el b/ivy.el
index e89fbd3..a565629 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1199,21 +1199,25 @@ This is useful for recursive `ivy-read'."
           (setq coll (cons preselect coll))))
       (setq ivy--old-re nil)
       (setq ivy--old-cands nil)
+      (when (integerp preselect)
+        (setq ivy--old-re "")
+        (setq ivy--index preselect))
       (when initial-input
         ;; Needed for anchor to work
         (setq ivy--old-cands coll)
         (setq ivy--old-cands (ivy--filter initial-input coll)))
       (setq ivy--all-candidates coll)
-      (setq ivy--index (or
-                        (and dynamic-collection
-                             ivy--index)
-                        (and preselect
-                             (ivy--preselect-index
-                              preselect
-                              (if initial-input
-                                  ivy--old-cands
-                                coll)))
-                        0)))
+      (unless (integerp preselect)
+        (setq ivy--index (or
+                          (and dynamic-collection
+                               ivy--index)
+                          (and preselect
+                               (ivy--preselect-index
+                                preselect
+                                (if initial-input
+                                    ivy--old-cands
+                                  coll)))
+                          0))))
     (setq ivy-exit nil)
     (setq ivy--default (or
                         (thing-at-point 'url)



reply via email to

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