Fix tab bar border artifacts with background_opacity on non-cell-aligned windows

Fixes #9663: visible gray/black bars appear at the left and right
sides of the tab bar when background_opacity is set and the window width
is not a multiple of the cell width.

Three fixes in update_blank_rects:

1. Fix off-by-one: use g.right instead of g.right-1 for the right blank
   rect start position. The old code caused a 1-pixel overlap with tab
   content and spuriously added a right blank rect even for
   perfectly-aligned windows.

2. Fix blank rect colors: only use tab_bar_left/right_edge_color when
   tab_bar_margin_width > 0 (explicit configured margin). When
   margin_width=0 (default), use default_bg which blends with the window
   background instead of showing a solid tab-colored bar.

3. Fix inner margin BOTTOM_EDGE height: use tab_bar.top instead of vh
   so the inner margin blank rect covers only the inner margin area.

Fixes #9664

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-03-15 02:55:31 +00:00 committed by Kovid Goyal
parent 30756bb819
commit b93f1badd1
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -687,7 +687,7 @@ def update_blank_rects(self, central: Region, tab_bar: Region, vw: int, vh: int)
if opts.tab_bar_margin_height.outer:
blank_rects.append(Border(0, tab_bar.bottom, vw, vh, bg))
if opts.tab_bar_margin_height.inner:
blank_rects.append(Border(0, central.bottom, vw, vh, bg))
blank_rects.append(Border(0, central.bottom, vw, tab_bar.top, bg))
else: # top
if opts.tab_bar_margin_height.outer:
blank_rects.append(Border(0, 0, vw, tab_bar.top, bg))
@ -695,13 +695,13 @@ def update_blank_rects(self, central: Region, tab_bar: Region, vw: int, vh: int)
blank_rects.append(Border(0, tab_bar.bottom, vw, central.top, bg))
g = self.window_geometry
left_bg = right_bg = bg
if opts.tab_bar_margin_color is None or opts.tab_bar_margin_width == 0:
if opts.tab_bar_margin_color is None and opts.tab_bar_margin_width > 0:
left_bg = BorderColor.tab_bar_left_edge_color
right_bg = BorderColor.tab_bar_right_edge_color
if g.left > 0:
blank_rects.append(Border(0, g.top, g.left, g.bottom, left_bg))
if g.right - 1 < vw:
blank_rects.append(Border(g.right - 1, g.top, vw, g.bottom, right_bg))
if g.right < vw:
blank_rects.append(Border(g.right, g.top, vw, g.bottom, right_bg))
self.blank_rects = tuple(blank_rects)
def layout(self) -> None: