diff options
| author | Daniel Mendler <mail@daniel-mendler.de> | 2025-11-07 16:35:21 +0100 |
|---|---|---|
| committer | Daniel Mendler <mail@daniel-mendler.de> | 2025-11-07 16:35:29 +0100 |
| commit | 4568d889525408ec862d70c00d8a3987195a5987 (patch) | |
| tree | 7d1a8ccbabcd12f6ff5b33cac7a64823e772f0d9 /corfu.el | |
| parent | 387f9acc5135206dfc6fbf6f19ebc69375209384 (diff) | |
Restructure corfu--in-region-1
Diffstat (limited to 'corfu.el')
| -rw-r--r-- | corfu.el | 25 |
1 files changed, 12 insertions, 13 deletions
@@ -975,19 +975,18 @@ See `completion-in-region' for the arguments BEG, END, TABLE, PRED." (total (alist-get 'corfu--total state)) (cands (alist-get 'corfu--candidates state))) (cond - ((<= total 1) - (cond - ;; Setup popup if completion can continue or if - ;; `corfu-on-exact-match' is `show'. - ((and (= total 1) - (or (eq corfu-on-exact-match 'show) - (consp (completion-try-completion - newstr table pred newpt - (completion-metadata newstr table pred))))) - (corfu--setup beg end table pred)) - ;; Otherwise exit completion with status `finished'. - ((test-completion newstr table pred) - (corfu--exit-function newstr 'finished cands)))) + ((= total 0) + (when (test-completion newstr table pred) + (corfu--exit-function newstr 'finished nil))) + ((= total 1) + ;; Setup popup if `corfu-on-exact-match' is `show' or if completion + ;; can continue. + (if (or (eq corfu-on-exact-match 'show) + (consp (completion-try-completion + newstr table pred newpt + (completion-metadata newstr table pred)))) + (corfu--setup beg end table pred) + (corfu--exit-function (car cands) 'finished nil))) ;; Too many candidates for cycling -> Setup popup. ((or (not threshold) (and (not (eq threshold t)) (< threshold total))) (corfu--setup beg end table pred)) |
