bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#39390: 28.0.50; prettify-symbols-mode confuses display when start/en


From: Eli Zaretskii
Subject: bug#39390: 28.0.50; prettify-symbols-mode confuses display when start/end faces are different
Date: Sun, 02 Feb 2020 19:18:52 +0200

> From: Raphael 'kena' Poss <address@hidden>
> Date: Sun, 2 Feb 2020 15:45:46 +0100
> 
> (add-hook 'go-mode-hook
>  (lambda ()
>    (push '("error" . ?⊙) prettify-symbols-alist)
>    ;; (push '("err != nil" . "⊙?") prettify-symbols-alist)
>  ))
> 
> However if I then uncomment the second substitution for "err != nil":
> all hell breaks loose: moving the cursor up and down around a source
> line containing this text will mess up the display of the lines that
> follow in a way that is sometimes irrecoverable.
> 
> The display bug is exacerbated (and thus easier to recognize/reproduce)
> when global-hl-line-mode is set.
> 
> I have traced this down to substitutions where the font-lock face at the
> beginning and the end of the symbol composition is different:
> 
> - replacing "String" is OK, replacing ".String()" is not
> - replacing "func" is OK, replacing "func(" is not
> - replacing "Fatal" is OK, replacing "t.Fatal" is not
> 
> This probably needs to be fixed somehow, either by preventing the
> problem or by documenting the pitfall.
> 
> I would like to know if a workaround is available?

You've bumped into a fundamental limitation of the feature, called
"character composition", that prettify-symbols-mode piggy-backs to do
its thing: Emacs can only compose characters that all have the same
face.  This restriction is imposed on a very low level of the display
code.

So I don't think there can be a workaround, except by "fixing" the
font-lock faces to use the same face on all the characters you want to
substitute.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]