branch: externals/vertico commit 452f1c931f090498c08297e5bf1f09e390f29f04 Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Daniel Mendler <m...@daniel-mendler.de>
Revert "BREAKING CHANGE: Always preselect the first candidate" This reverts commit 565faea4b76860e68e7d92ca7d3295a146c3dce4. --- CHANGELOG.org | 2 -- vertico.el | 14 +++++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.org b/CHANGELOG.org index 427d2ff03f..903b9b7a67 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -4,8 +4,6 @@ * Development -- BREAKING CHANGE: Always preselect the first candidate. This mainly changes the - behavior of =find-file=. In order to open directories, press =M-RET=. - Emacs 29: Add support for =REQUIRE-MATCH= functions * Version 0.29 (2022-11-22) diff --git a/vertico.el b/vertico.el index b4c8d8bd1f..e5499aff50 100644 --- a/vertico.el +++ b/vertico.el @@ -358,9 +358,17 @@ The function is configured by BY, BSIZE, BINDEX, BPRED and PRED." (vertico--lock-candidate . ,lock) (vertico--groups . ,(cadr groups)) (vertico--all-groups . ,(or (caddr groups) vertico--all-groups)) - ;; Compute new index. Select the prompt if there are no candidates or if - ;; the default is missing from the candidate list. - (vertico--index . ,(or lock (if (or def-missing (not all)) -1 0)))))) + ;; Compute new index. Select the prompt under these conditions: + ;; * If there are no candidates + ;; * If the default is missing from the candidate list. + ;; * For matching content, as long as the full content + ;; after the boundary is empty, including content after point. + (vertico--index . ,(or lock + (if (or def-missing (not all) + (and (= (length vertico--base) (length content)) + (test-completion content minibuffer-completion-table + minibuffer-completion-predicate))) + -1 0)))))) (defun vertico--cycle (list n) "Rotate LIST to position N."