Skip to content

Commit

Permalink
ivy.el (ivy-partial-or-done): Work with completion-cycle-threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
abo-abo authored and astoff committed Jan 1, 2021
1 parent 4e2ab60 commit 4f7c602
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions ivy.el
Expand Up @@ -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'."
Expand Down

0 comments on commit 4f7c602

Please sign in to comment.