Subject: bug#39390: 28.0.50; prettify-symbols-mode confuses display when start/end faces are different

From: Tassilo Horn <[email-masked]>
Date: Mon, 17 Feb 2020 16:59:38 +0100

Raphael 'kena' Poss <[email-masked]> writes:

> Finally, let us not distract ourselves with this detail. The bug is
> readily reproducible with a single character:
>
> https://asciinema.org/a/IGDZhOMnmF7sAWJYEjRqPdboA
>
> Regarding point (2). Multiple characters in the output actually works
> fine most of the time. Please double check the title of this e-mail
> thread and the reason why I reported the issue in the first place:
>
> - replacing either a single character or multiple characters in the
> buffer, even separated by blanks, is fine as long as they display with
> just 1 face.
>
> - replacing anything with either a single or multiple characters in
> the result of the composition is fine as long as the input uses just 1
> face.
>
> There is an error in the display code when compose-region composes
> over multiple faces, and I'd like us to focus on that.  I'm pretty
> sure that pretty-symbols-mode is just one of multiple ways one can
> trigger this bug.

Indeed, that's the real problem.  I guess that there's an implicit
assumption that composition always takes place in one word or symbol
which is almost always fontified with just one face.  Your example
invalidates that assumption.

But then the question is how the composition should be displayed?  In
your example where you replace "setq abc" with the LAST QUARTER MOON
WITH FACE Unicode character, should that have font-lock-keyword-face
(like setq) or the default face (like abc)?

Bye,
Tassilo