Subject: bug#50660: 28.0.50; Text artifacting when the cursor moves over text under mouse face that originally displayed a box

From: Eli Zaretskii <[email-masked]>
Date: Mon, 20 Sep 2021 15:36:12 +0300

> From: Po Lu <[email-masked]>
> Cc: [email-masked],  [email-masked]
> Date: Mon, 20 Sep 2021 19:08:13 +0800
> 
> Thanks, but I already cooked something up.  The adjustment, in my case,
> is done in draw_phys_cursor_glyph, conditional on
> cursor_in_mouse_face_p.
> 
> Is there anything wrong with this approach?  Thanks.

One other problem with this implementation is that the additional code
will run when the mouse-highlight is removed as well, in which case we
know that no adjustment is needed for w->phys_cursor.x.

Also, I think it's incorrect to add mouse->box_vertical_line_width to
_every_ glyph that in the regular face has this attribute.  That's
because the entire mouse-highlighted area has just two glyphs which
could have a box line near it: the first and the last one.  So you
should only add it once.  Try this code on a screen line with several
different  stretches of characters with the box face, and arrange for
all of these stretches to be mouse-highlighted together.

Moreover, if the mouse-highlighted text takes more than one screen
line (a.k.a. "glyph row"), only the first screen line/glyph row need
to have the mouse->box_vertical_line_width added.