[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#71419: 30.0.50; Completion does not always highlight the "common par
From: |
Dmitry Gutov |
Subject: |
bug#71419: 30.0.50; Completion does not always highlight the "common part" corresponding to suffix |
Date: |
Sun, 9 Jun 2024 23:38:57 +0300 |
User-agent: |
Mozilla Thunderbird |
On 09/06/2024 16:52, Stefan Monnier wrote:
For example:
1. Type (fo|-function
2. C-M-i
You get 5 completions (the exact number is not important), where "fo" is
highlighted in all of them, but "function is not.
Looks like a bug in the `basic` completion style: it filters things that
match the glob pattern `fo*-function` yet it only highlights the prefix.
Yes, thanks. Looks like this one-liner fixes it:
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index f62cb2566b2..144cda8cfdc 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -3816,7 +3816,7 @@ completion-basic-all-completions
'point
(substring afterpoint 0 (cdr bounds)))))
(all (completion-pcm--all-completions prefix pattern table
pred)))
- (completion-hilit-commonality all point (car bounds))))
+ (completion-pcm--hilit-commonality pattern all)))
;;; Partial-completion-mode style completion.
Also, highlighting is information. If it was more uniform, we could use
it to e.g. address the FIXME in completion-all-completions.
I don't think it could be trusted to always provide the needed data (and
even if it does, it would be sufficiently clunky to use that I'm not
sure we'd want to rely on it).
You're probably right.
But it would have been nice to be able to use it in the "progressive
improvement" kind of fashion: when the suffix and the other parts are
highlighted correctly, we do the right thing; if the style missed the
suffix highlighting, we do the other thing - and put the responsibility
on the third party.