From b93f1badd18d565a1a6cbc14d5922fd9aca20402 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Mar 2026 02:55:31 +0000 Subject: [PATCH] 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> --- kitty/tab_bar.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kitty/tab_bar.py b/kitty/tab_bar.py index 4ecd9633e..aaf96f598 100644 --- a/kitty/tab_bar.py +++ b/kitty/tab_bar.py @@ -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: