[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/corfu 2050453a7e: corfu--in-region-1: Handle zero candi
From: |
ELPA Syncer |
Subject: |
[elpa] externals/corfu 2050453a7e: corfu--in-region-1: Handle zero candidates after try-completion |
Date: |
Fri, 20 Dec 2024 18:57:41 -0500 (EST) |
branch: externals/corfu
commit 2050453a7ea5734fe85cdfd276e946ad59b1dd56
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
corfu--in-region-1: Handle zero candidates after try-completion
Fix #538
---
corfu.el | 42 +++++++++++++++++++++++-------------------
1 file changed, 23 insertions(+), 19 deletions(-)
diff --git a/corfu.el b/corfu.el
index cbe7aa691c..34af31a6ba 100644
--- a/corfu.el
+++ b/corfu.el
@@ -943,26 +943,30 @@ See `completion-in-region' for the arguments BEG, END,
TABLE, PRED."
(let* ((state (corfu--recompute newstr newpt table pred))
(base (alist-get 'corfu--base state))
(total (alist-get 'corfu--total state))
- (candidates (alist-get 'corfu--candidates state)))
- (if (= total 1)
- ;; If completion is finished and cannot be further completed, and
- ;; the value of `corfu-on-exact-match' is not 'show, return
- ;; 'finished. Otherwise setup the Corfu popup.
- (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 newstr 'finished candidates))
- (if (or (= total 0) (not threshold)
- (and (not (eq threshold t)) (< threshold total)))
+ (cands (alist-get 'corfu--candidates state)))
+ (cond
+ ((= total 0)
+ ;; No candidates found for `newstr' -> Completion is finished.
+ (corfu--exit-function newstr 'finished nil))
+ ((= total 1)
+ ;; If completion is finished and cannot be extended further and
+ ;; `corfu-on-exact-match' is not 'show, return 'finished. Otherwise
+ ;; setup the popup.
+ (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--cycle-candidates total candidates (+ (length base) beg)
end)
- ;; Do not show Corfu when "trivially" cycling, i.e.,
- ;; when the completion is finished after the candidate.
- (unless (equal (completion-boundaries (car candidates) table pred
"")
- '(0 . 0))
- (corfu--setup beg end table pred)))))
+ (corfu--exit-function newstr 'finished cands)))
+ ;; Too many candidates for cycling -> Setup popup.
+ ((or (not threshold) (and (not (eq threshold t)) (< threshold
total)))
+ (corfu--setup beg end table pred))
+ (t
+ ;; Cycle through candidates.
+ (corfu--cycle-candidates total cands (+ (length base) beg) end)
+ ;; Do not show Corfu when completion is finished after the
candidate.
+ (unless (equal (completion-boundaries (car cands) table pred "")
'(0 . 0))
+ (corfu--setup beg end table pred)))))
t))))
(defun corfu--message (&rest msg)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/corfu 2050453a7e: corfu--in-region-1: Handle zero candidates after try-completion,
ELPA Syncer <=