summaryrefslogtreecommitdiff
path: root/corfu.el
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2025-11-07 16:35:21 +0100
committerDaniel Mendler <mail@daniel-mendler.de>2025-11-07 16:35:29 +0100
commit4568d889525408ec862d70c00d8a3987195a5987 (patch)
tree7d1a8ccbabcd12f6ff5b33cac7a64823e772f0d9 /corfu.el
parent387f9acc5135206dfc6fbf6f19ebc69375209384 (diff)
Restructure corfu--in-region-1
Diffstat (limited to 'corfu.el')
-rw-r--r--corfu.el25
1 files changed, 12 insertions, 13 deletions
diff --git a/corfu.el b/corfu.el
index 7012a9d..0868a81 100644
--- a/corfu.el
+++ b/corfu.el
@@ -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))