Subject: bug#4911: mouse-face property should merge face attributes, not replace

From: Eli Zaretskii <[email-masked]>
Date: Sun, 26 Apr 2020 16:34:11 +0300

> From: Clément Pit-Claudel <[email-masked]>
> Date: Sat, 25 Apr 2020 23:10:42 -0400
> Cc: Lars Ingebrigtsen <[email-masked]>
> 
> > Maybe Eli meant something like what I suggested above:
> > adding an underline without changing the foreground
> > and background colors of the text.  Yes, that could
> > be done by face merging (and yes, currently the normal
> > fontification gets obliterated).
> 
> I think that would be great.  Maybe I misunderstood: I thought Eli was suggesting a workaround that worked with Emacs as it is (which would explain why Lars closed the bug), but indeed currently using an underline still removes other face properties.

No, this cannot be done with the current display code, and I'm sorry I
posted a confusing suggestion.

If someone wants to work on an option whereby we will merge the mouse
face with the face of each highlighted character, that would be
welcome.  I just want to warn volunteers that providing such a feature
is not going to be simple: the way mouse-highlight is currently
implemented we simply redraw a stretch of glyphs on the screen with a
face that is already "realized" and cached (see xfaces.c).  Which
means face merging has been already done, and we can only use the
existing faces which were merged long ago.  Making this new feature
happen would then require reimplementing mouse-highlight similar to
the region (some kind of overlay), and I hope the result will not
cause annoying flicker, since in principle we will have to trigger
redisplay on each mouse move, unlike a much simpler redraw we do now.