summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2022-04-30 06:31:49 +0200
committerDaniel Mendler <mail@daniel-mendler.de>2022-04-30 06:31:49 +0200
commit9b199fafdaeca1fda41aca17c6b486ba224f60cb (patch)
treecc78f2075c856834af5106ea80aa0c766c422656
parenta37d7272a5fa45bcba106f5ba2fb8867f6153ec7 (diff)
corfu--in-region: Fix behavior for single match
- If further completion is possible, setup the Corfu popup. - Otherwise call the exit function.
-rw-r--r--corfu.el14
1 files changed, 8 insertions, 6 deletions
diff --git a/corfu.el b/corfu.el
index dc29dfd..0462371 100644
--- a/corfu.el
+++ b/corfu.el
@@ -1090,12 +1090,14 @@ See `completion-in-region' for the arguments BEG, END, TABLE, PRED."
(completion--replace beg end (concat newstr)))
(goto-char (+ beg newpt))
(if (= total 1)
- (when exit
- (funcall exit newstr
- ;; If completion is finished and cannot be further completed,
- ;; return 'finished. Otherwise return 'exact.
- (if (eq (try-completion (car candidates) table pred) t)
- 'finished 'exact)))
+ ;; If completion is finished and cannot be further completed,
+ ;; return 'finished. Otherwise setup the Corfu popup.
+ (cond
+ ((consp (completion-try-completion
+ newstr table pred newpt
+ (completion-metadata newstr table pred)))
+ (corfu--setup))
+ (exit (funcall exit newstr 'finished)))
(if (or (= total 0) (not threshold)
(and (not (eq threshold t)) (< threshold total)))
(corfu--setup)