summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2021-04-17 23:59:52 +0200
committerDaniel Mendler <mail@daniel-mendler.de>2021-04-17 23:59:52 +0200
commit5214170fd416efe395cbeb33d4fc4391189070c3 (patch)
treec82aa1489ae5785d6ddc44959320b93a03f2bec9
parent59263bf7bc4e85651f31d893c3750375aefcad64 (diff)
Add base string when previewing the current candidate
-rw-r--r--corfu.el4
1 files changed, 2 insertions, 2 deletions
diff --git a/corfu.el b/corfu.el
index 4c623ae..e28831a 100644
--- a/corfu.el
+++ b/corfu.el
@@ -394,7 +394,7 @@ If `line-spacing/=nil' or in text-mode, the background color is used instead.")
(not (and (= (car bounds) (length str)) (test-completion str table pred)))
;; XXX Completion is terminated if there are no matches. Add optional confirmation?
corfu--candidates
- ;; Single candidate
+ ;; Single candidate, which matches input exactly
(not (equal corfu--candidates (list str))))
(let* ((start (min (max 0 (- corfu--index (/ corfu-count 2)))
(max 0 (- corfu--total corfu-count))))
@@ -408,7 +408,7 @@ If `line-spacing/=nil' or in text-mode, the background color is used instead.")
(let ((ov (make-overlay beg end nil t t)))
(overlay-put ov 'priority 1000)
(overlay-put ov 'window (selected-window))
- (overlay-put ov 'display (nth curr cands))
+ (overlay-put ov 'display (concat (substring str 0 corfu--base) (nth curr cands)))
(push ov corfu--overlays)))
;; Nonlinearity at the end and the beginning
(when (/= start 0)