summaryrefslogtreecommitdiff
path: root/corfu.el
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2025-11-07 17:01:47 +0100
committerDaniel Mendler <mail@daniel-mendler.de>2025-11-07 17:01:47 +0100
commit38d9cd90fdaedafdf6f3c8bd0b2a0afac7c80e62 (patch)
treedace2026eb01e1de9d69b1b9b9b5cbe0d697b44b /corfu.el
parent08c85928c3f0dfccb659cd3f26733095d16ab3a1 (diff)
Call completion-try-completion with correct metadata
Diffstat (limited to 'corfu.el')
-rw-r--r--corfu.el15
1 files changed, 9 insertions, 6 deletions
diff --git a/corfu.el b/corfu.el
index 6dde769..01ab05f 100644
--- a/corfu.el
+++ b/corfu.el
@@ -951,11 +951,11 @@ See `completion-in-region' for the arguments BEG, END, TABLE, PRED."
(when completion-in-region-mode (corfu-quit))
(let* ((pt (max 0 (- (point) beg)))
(str (buffer-substring-no-properties beg end))
- (metadata (completion-metadata (substring str 0 pt) table pred))
- (threshold (completion--cycle-threshold metadata))
+ (md (completion-metadata (substring str 0 pt) table pred))
+ (threshold (completion--cycle-threshold md))
(completion-in-region-mode-predicate
(or completion-in-region-mode-predicate #'always)))
- (pcase (completion-try-completion str table pred pt metadata)
+ (pcase (completion-try-completion str table pred pt md)
('nil (corfu--message "No match") nil)
('t (goto-char end)
(corfu--message "Sole match")
@@ -1212,7 +1212,9 @@ AUTO is non-nil when initializing auto completion."
(equal (car corfu--candidates) str) (not (cdr corfu--candidates))
(not (eq corfu-on-exact-match 'show))
(or auto corfu-on-exact-match)
- (not (consp (completion-try-completion str table pred pt corfu--metadata))))
+ (not (consp (completion-try-completion
+ str table pred pt
+ (completion-metadata (substring str 0 pt) table pred)))))
;; Quit directly when initializing auto completion.
(if (or auto (eq corfu-on-exact-match 'quit))
(corfu-quit)
@@ -1380,8 +1382,9 @@ input has been expanded."
(corfu-complete)
(pcase-let* ((`(,beg ,end ,table ,pred . ,_) completion-in-region--data)
(pt (max 0 (- (point) beg)))
- (str (buffer-substring-no-properties beg end)))
- (pcase (completion-try-completion str table pred pt corfu--metadata)
+ (str (buffer-substring-no-properties beg end))
+ (md (completion-metadata (substring str 0 pt) table pred)))
+ (pcase (completion-try-completion str table pred pt md)
('t
(goto-char end)
(corfu--done str 'finished corfu--candidates)