summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2025-04-15 08:10:08 +0200
committerDaniel Mendler <mail@daniel-mendler.de>2025-04-15 08:10:08 +0200
commit5834e3ed652068209a653ea067f91d3f537d0be5 (patch)
treebca725286b72fdde1c535278a85932b632a28d81
parent62709792cb17d679ad0f10d1246fe30f401cffac (diff)
Improve lazy highlighting for quoted candidates (bug#77754)
-rw-r--r--corfu.el12
1 files changed, 8 insertions, 4 deletions
diff --git a/corfu.el b/corfu.el
index b9ab640..b9b8b7d 100644
--- a/corfu.el
+++ b/corfu.el
@@ -777,10 +777,14 @@ FRAME is the existing frame."
(pcase-let* ((last (min (+ corfu--scroll corfu-count) corfu--total))
(bar (ceiling (* corfu-count corfu-count) corfu--total))
(lo (min (- corfu-count bar 1) (floor (* corfu-count corfu--scroll) corfu--total)))
- (`(,mf . ,acands) (corfu--affixate
- (cl-loop repeat corfu-count
- for c in (nthcdr corfu--scroll corfu--candidates)
- collect (funcall corfu--hilit (substring c)))))
+ (`(,mf . ,acands)
+ (corfu--affixate
+ (cl-loop
+ repeat corfu-count for c in (nthcdr corfu--scroll corfu--candidates)
+ collect (funcall corfu--hilit
+ ;; bug#77754: Highlight unquoted string.
+ (substring (or (get-text-property
+ 0 'completion--unquoted c) c))))))
(`(,pw ,width ,fcands) (corfu--format-candidates acands))
;; Disable the left margin if a margin formatter is active.
(corfu-left-margin-width (if mf 0 corfu-left-margin-width)))