branch: master commit db3e7ffe9b76932c6ba3109ffcf5b1ebe1f60cf0 Author: Oleh Krehel <ohwoeo...@gmail.com> Commit: Oleh Krehel <ohwoeo...@gmail.com>
Ensure the return result of `ivy-read' In some cases, `read-from-minibuffer' will return the whole minibuffer contents (i.e. all available candidates). Return `ivy--current' instead. --- ivy.el | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/ivy.el b/ivy.el index 97b601e..704a71c 100644 --- a/ivy.el +++ b/ivy.el @@ -1132,30 +1132,30 @@ customizations apply to the current completion session." (ivy--reset-state ivy-last) (prog1 (unwind-protect - (minibuffer-with-setup-hook - #'ivy--minibuffer-setup - (let* ((hist (or history 'ivy-history)) - (minibuffer-completion-table collection) - (minibuffer-completion-predicate predicate) - (resize-mini-windows (cond - ((display-graphic-p) nil) - ((null resize-mini-windows) 'grow-only) - (t resize-mini-windows))) - (res (read-from-minibuffer - prompt - (ivy-state-initial-input ivy-last) - (make-composed-keymap keymap ivy-minibuffer-map) - nil - hist))) - (when (eq ivy-exit 'done) - (let ((item (if ivy--directory - ivy--current - ivy-text))) - (unless (equal item "") - (set hist (cons (propertize item 'ivy-index ivy--index) - (delete item - (cdr (symbol-value hist))))))) - res))) + (minibuffer-with-setup-hook + #'ivy--minibuffer-setup + (let* ((hist (or history 'ivy-history)) + (minibuffer-completion-table collection) + (minibuffer-completion-predicate predicate) + (resize-mini-windows (cond + ((display-graphic-p) nil) + ((null resize-mini-windows) 'grow-only) + (t resize-mini-windows)))) + (read-from-minibuffer + prompt + (ivy-state-initial-input ivy-last) + (make-composed-keymap keymap ivy-minibuffer-map) + nil + hist) + (when (eq ivy-exit 'done) + (let ((item (if ivy--directory + ivy--current + ivy-text))) + (unless (equal item "") + (set hist (cons (propertize item 'ivy-index ivy--index) + (delete item + (cdr (symbol-value hist)))))))) + ivy--current)) (remove-hook 'post-command-hook #'ivy--exhibit) (when (setq unwind (ivy-state-unwind ivy-last)) (funcall unwind))