Subject: bug#79279: 28.2; Combining characters cause formatting problems when showing CAP candidates

From: Eli Zaretskii <[email-masked]>
Date: Thu, 21 Aug 2025 17:00:52 +0300

[Please use Reply All to reply, to keep the bug tracker on the CC list.]

> From: Dmitry Safronov <[email-masked]>
> Date: Thu, 21 Aug 2025 13:25:58 +0200
> 
> > Presenting text which starts with a combining character indeed needs
> some special code, but that code should be in the Lisp program which
> creates the text.  And given what you tell, I don't yet have an idea
> where that Lisp program is: in Emacs core, in Julia, somewhere else?
> 
> The text was indeed produced by the julia-mode package, namely by the
> `julia--latexsub-capf-list` function for creating a CAPF completion
> table for that mode.
> However, the list of completion candidates (based on that completion
> table) in the
> "*Completions*" buffer was produced by the Emacs core (`display-completion-list`
> function defined in `minibuffer.el`).
> 
> Therefore, I think, a proper handling of annotation text which starts with a
> combining character should nevertheless be addressed in Emacs core (for example,
> by prepending annotations starting with a combining character by a
> zero-width space
> U+200B).

But display-completion-list just shows the strings it gets as its
argument.  AFAIU, theses strings already include both the completion
candidate and its visualization (which causes the problem).  If that
is correct, then the code which generates those strings is the one we
need to fix.  Can you (or someone else of the people I CC) point to
the code which generates those strings?