]> code.delx.au - gnu-emacs-elpa/commitdiff
ivy.el (ivy-partial-or-done): More predictability
authorOleh Krehel <ohwoeowho@gmail.com>
Wed, 13 May 2015 21:47:12 +0000 (23:47 +0200)
committerOleh Krehel <ohwoeowho@gmail.com>
Wed, 13 May 2015 21:47:12 +0000 (23:47 +0200)
* ivy.el (ivy-partial-or-done): Forward to `ivy-alt-done' only if
  `ivy-partial' did nothing new, and either previous command was
  `ivy-partial-or-done', or there's exactly one matching candidate.

Fixes #107

ivy.el

diff --git a/ivy.el b/ivy.el
index 22b8ac69c77844852cb7aa6691706e395a4fb434..121e8f510ce292034217703c3e6eef632aacae1e 100644 (file)
--- a/ivy.el
+++ b/ivy.el
@@ -305,7 +305,9 @@ If the text hasn't changed as a result, forward to `ivy-alt-done'."
                    (= ivy--length 1))
           (ivy--cd (expand-file-name ivy-text))))
     (or (ivy-partial)
-        (ivy-alt-done))))
+        (when (or (eq this-command last-command)
+                  (eq ivy--length 1))
+          (ivy-alt-done)))))
 
 (defun ivy-partial ()
   "Complete the minibuffer text as much as possible."