branch: externals/ivy commit 05f1d8218180457c6cbd72ae1c7c3355b574f8bc Author: Basil L. Contovounesios <ba...@contovou.net> Commit: Basil L. Contovounesios <ba...@contovou.net>
Fix some point placement on exact completion exit When completing ~/foo and ~/foobar is the only completion, vanilla completion inserts a trailing space on exit to indicate an exact match, even though completion-try-completion returned a cons. This is determined by completion--done which calls try-completion on the completion-try-completion return value i.s.o. the completion-all-completions candidate that was inserted. * ivy.el (ivy-completion-in-region-action): Prefer passing completion-try-completion 'new string' to completion--done when possible. --- ivy.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ivy.el b/ivy.el index 38a4575170..a109025e09 100644 --- a/ivy.el +++ b/ivy.el @@ -2622,10 +2622,11 @@ The previous string is between `ivy-completion-beg' and `ivy-completion-end'." (ivy-state-collection ivy-last))) (minibuffer-completion-predicate (if (boundp 'ivy--minibuffer-pred) ivy--minibuffer-pred - (ivy-state-predicate ivy-last)))) - (completion--done str (cond ((eq ivy--minibuffer-try t) 'finished) - ((eq ivy-exit 'done) 'unknown) - ('exact)))) + (ivy-state-predicate ivy-last))) + (newstr (or (car-safe ivy--minibuffer-try) str))) + (completion--done newstr (cond ((eq ivy--minibuffer-try t) 'finished) + ((eq ivy-exit 'done) 'unknown) + ('exact)))) (setq ivy-completion-end (point)) (save-excursion (dolist (cursor fake-cursors)