Subject: bug#52324: 29.0.50; "Padded" mode line lacks uniform border

From: Po Lu <[email-masked]>
Date: Sun, 12 Dec 2021 08:58:32 +0800

Eli Zaretskii <[email-masked]> writes:

> Lu, can you help?  This has something to do with clipping, because the
> overline disappears in this call to x_reset_clip_rectangles at the end
> of x_draw_glyph_string:
>
>
>   /* Reset clipping.  */
>   x_reset_clip_rectangles (s->f, s->gc);  <<<<<<<<<<<<<<<<<<<<<<<<<
>   s->num_clips = 0;
>
> Before that call, I see the overline and underline of the stretch
> glyph on the mode line as expected.  But I cannot understand what is
> missing to avoid this removal of the overline and underline.

That's a red herring.  The problem is that the box (which is already
present on the mode-line face) is drawn after the overline on top of
non-character and non-composition glyph strings, such as stretch
strings.

The correct solution is to move this code:

      /* Draw relief if not yet drawn.  */
      if (!relief_drawn_p && s->face->box != FACE_NO_BOX)
	x_draw_glyph_string_box (s);

To run before drawing the overline.  I tested and it works here, so if
you have no objections I will make that change in xterm and on the other
*terms as well.

Protesilaos, you should also turn off
x-use-underline-position-properties; otherwise, the underline will
appear somewhere inside the modeline and not underneath it.