diff options
| author | Daniel Mendler <mail@daniel-mendler.de> | 2021-08-10 11:39:09 +0200 |
|---|---|---|
| committer | Daniel Mendler <mail@daniel-mendler.de> | 2021-08-10 11:39:09 +0200 |
| commit | 5164177638322420eca16c0cb94b9b19e3fba67a (patch) | |
| tree | f6a075080c9d3791a395f2618ac5919834878127 | |
| parent | 68ea28e987f4079f45916800f1a7b9530600a198 (diff) | |
Refine the corfu-complete criterion
| -rw-r--r-- | corfu.el | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -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) |
