From c1f9d62b27740b1bc0628f2f0bac86a4ac9c3768 Mon Sep 17 00:00:00 2001 From: Andros Fenollosa Date: Wed, 3 Jun 2026 08:11:38 +0200 Subject: [PATCH] Metal: inset glyph-string background fill by the box line width Match ns_maybe_dumpglyphs_background: fill the background from s->y + box_line_width with height s->height - 2*box_line_width instead of the full cell height. For a boxed face (e.g. the selected tab-bar tab, or a boxed mode-line) this leaves the box edge rows untouched, so the relief drawn afterwards is not first overwritten with the background and then redrawn on top. For unboxed faces box_line_width is 0, so it is identical to the previous full-height fill (AE vs NS unchanged at 0.88%). --- src/mtlterm.m | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/mtlterm.m b/src/mtlterm.m index c0798d9fe95..1f4e5c9d178 100644 --- a/src/mtlterm.m +++ b/src/mtlterm.m @@ -1999,11 +1999,16 @@ mtl_draw_glyph_string_impl (struct glyph_string *s) fg = face ? face->background : 0xFFFFFF; } - /* Background fill */ + /* Background fill. Inset vertically by the box line width, exactly like the + NS backend (ns_maybe_dumpglyphs_background): for a boxed face (e.g. the + selected tab-bar tab) this leaves the box edge rows untouched so the relief + drawn afterwards is not overwritten and then redrawn. For unboxed faces + box_line_width is 0, so this is identical to filling the full height. */ if (!s->background_filled_p) { - NSRect bgr = NSMakeRect (s->x, s->y, - s->background_width, s->height); + int blw = face ? max (face->box_horizontal_line_width, 0) : 0; + NSRect bgr = NSMakeRect (s->x, s->y + blw, + s->background_width, s->height - 2 * blw); [fd fillRect:bgr color:bg]; s->background_filled_p = true; }