branch: master
commit 2c39e102a38621acdeca5362917f8f3e11aed3fe
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
"TAB" shouldn't delete input when no candidate
ivy.el (ivy-partial-or-done): Update.
Fixes #74
---
ivy.el | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/ivy.el b/ivy.el
index 980046b..15506e2 100644
--- a/ivy.el
+++ b/ivy.el
@@ -279,7 +279,7 @@ When called twice in a row, exit the minibuffer with the
current
candidate."
(interactive)
(if (eq this-command last-command)
- (progn
+ (when (> (length ivy--current) 0)
(delete-minibuffer-contents)
(insert ivy--current)
(setq ivy-exit 'done)
@@ -290,10 +290,11 @@ candidate."
(new (try-completion postfix
(mapcar (lambda (str) (substring str
(string-match postfix str)))
ivy--old-cands))))
- (delete-region (minibuffer-prompt-end) (point-max))
- (setcar (last parts) new)
- (insert (mapconcat #'identity parts " ")
- (if ivy-tab-space " " "")))))
+ (when new
+ (delete-region (minibuffer-prompt-end) (point-max))
+ (setcar (last parts) new)
+ (insert (mapconcat #'identity parts " ")
+ (if ivy-tab-space " " ""))))))
(defun ivy-immediate-done ()
"Exit the minibuffer with the current input."