branch: externals/corfu commit 5164177638322420eca16c0cb94b9b19e3fba67a Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Daniel Mendler <m...@daniel-mendler.de>
Refine the corfu-complete criterion --- corfu.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/corfu.el b/corfu.el index 7364887..5acfa03 100644 --- a/corfu.el +++ b/corfu.el @@ -813,15 +813,16 @@ completion began less than that number of seconds ago." ((and `(,newstr . ,newpt) (guard (not (equal str newstr)))) (completion--replace beg end newstr) (goto-char (+ beg newpt))) - ;; When the last command was `corfu-complete' and we didn't make progress, - ;; insert the first candidate. - ((guard (and (eq last-command #'corfu-complete) (> corfu--total 0))) + ;; If we didn't make progress, the last command was `corfu-complete' + ;; and we are not at completion boundary, continue with the first candidate. + ((guard (and (eq last-command #'corfu-complete) + (> (length str) corfu--base) + (> corfu--total 0))) (completion--replace beg end (concat (substring str 0 corfu--base) (substring-no-properties (car corfu--candidates)))))))))) - (defun corfu--insert (status) "Insert current candidate, exit with STATUS if non-nil." (pcase-let* ((`(,beg ,end ,table ,pred) completion-in-region--data)