branch: master commit 64c0804cc5c3c75d72b549a285bfb6ba1ac3cb67 Author: Oleh Krehel <ohwoeo...@gmail.com> Commit: Oleh Krehel <ohwoeo...@gmail.com>
ivy.el (ivy-partial-or-done): Work with completion-cycle-threshold Fixes #2225 --- ivy.el | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/ivy.el b/ivy.el index 8411067..ed6d2c8 100644 --- a/ivy.el +++ b/ivy.el @@ -1092,20 +1092,25 @@ When this directory doesn't exist, return nil." "Complete the minibuffer text as much as possible. If the text hasn't changed as a result, forward to `ivy-alt-done'." (interactive) - (if (and (eq (ivy-state-collection ivy-last) #'read-file-name-internal) - (or (and (equal ivy--directory "/") - (string-match-p "\\`[^/]+:.*\\'" ivy-text)) - (= (string-to-char ivy-text) ?/))) - (let ((default-directory ivy--directory) - dir) - (minibuffer-complete) - (setq ivy-text (ivy--input)) - (when (setq dir (ivy-expand-file-if-directory ivy-text)) - (ivy--cd dir))) - (or (ivy-partial) - (when (or (eq this-command last-command) - (eq ivy--length 1)) - (ivy-alt-done))))) + (cond + ((and completion-cycle-threshold (< (length ivy--all-candidates) completion-cycle-threshold)) + (let ((ivy-wrap t)) + (ivy-next-line))) + ((and (eq (ivy-state-collection ivy-last) #'read-file-name-internal) + (or (and (equal ivy--directory "/") + (string-match-p "\\`[^/]+:.*\\'" ivy-text)) + (= (string-to-char ivy-text) ?/))) + (let ((default-directory ivy--directory) + dir) + (minibuffer-complete) + (setq ivy-text (ivy--input)) + (when (setq dir (ivy-expand-file-if-directory ivy-text)) + (ivy--cd dir)))) + (t + (or (ivy-partial) + (when (or (eq this-command last-command) + (eq ivy--length 1)) + (ivy-alt-done)))))) (defun ivy--remove-prefix (prefix string) "Compatibility shim for `string-remove-prefix'."