Tab bar left margin should be drawn in the same background color as the other margins

This commit is contained in:
Kovid Goyal 2021-10-25 09:00:49 +05:30
parent 0e29ee9299
commit baf080f147
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -476,22 +476,11 @@ class TabBar:
elif bg is False: elif bg is False:
bg = color_as_int(opts.tab_bar_background or opts.background) bg = color_as_int(opts.tab_bar_background or opts.background)
self.screen.color_profile.set_configured_colors(fg, bg) self.screen.color_profile.set_configured_colors(fg, bg)
self.update_blank_rects()
def layout(self) -> None: def update_blank_rects(self) -> None:
central, tab_bar, vw, vh, cell_width, cell_height = viewport_for_window(self.os_window_id)
if tab_bar.width < 2:
return
opts = get_options() opts = get_options()
self.cell_width = cell_width central, tab_bar, vw, vh, cell_width, cell_height = viewport_for_window(self.os_window_id)
s = self.screen
viewport_width = max(4 * cell_width, tab_bar.width - 2 * self.margin_width)
ncells = viewport_width // cell_width
s.resize(1, ncells)
s.reset_mode(DECAWM)
self.laid_out_once = True
margin = (viewport_width - ncells * cell_width) // 2 + self.margin_width
self.window_geometry = g = WindowGeometry(
margin, tab_bar.top, viewport_width - margin, tab_bar.bottom, s.columns, s.lines)
blank_rects: List[Border] = [] blank_rects: List[Border] = []
if opts.tab_bar_margin_height: if opts.tab_bar_margin_height:
bg = BorderColor.default_bg bg = BorderColor.default_bg
@ -505,13 +494,31 @@ class TabBar:
blank_rects.append(Border(0, 0, vw, tab_bar.top, bg)) blank_rects.append(Border(0, 0, vw, tab_bar.top, bg))
if opts.tab_bar_margin_height.inner: if opts.tab_bar_margin_height.inner:
blank_rects.append(Border(0, tab_bar.bottom + 1, vw, central.top, bg)) blank_rects.append(Border(0, tab_bar.bottom + 1, vw, central.top, bg))
if margin > 0: g = self.window_geometry
bg = BorderColor.default_bg if opts.tab_bar_background is None else BorderColor.tab_bar_bg if g.left > 0:
viewport_width = max(4 * cell_width, tab_bar.width - 2 * self.margin_width)
bg = BorderColor.default_bg
blank_rects.append(Border(0, g.top, g.left, g.bottom + 1, bg)) blank_rects.append(Border(0, g.top, g.left, g.bottom + 1, bg))
blank_rects.append(Border(g.right - 1, g.top, viewport_width, g.bottom + 1, bg)) blank_rects.append(Border(g.right - 1, g.top, viewport_width, g.bottom + 1, bg))
self.blank_rects = tuple(blank_rects) self.blank_rects = tuple(blank_rects)
def layout(self) -> None:
central, tab_bar, vw, vh, cell_width, cell_height = viewport_for_window(self.os_window_id)
if tab_bar.width < 2:
return
self.cell_width = cell_width
s = self.screen
viewport_width = max(4 * cell_width, tab_bar.width - 2 * self.margin_width)
ncells = viewport_width // cell_width
s.resize(1, ncells)
s.reset_mode(DECAWM)
self.laid_out_once = True
margin = (viewport_width - ncells * cell_width) // 2 + self.margin_width
self.window_geometry = g = WindowGeometry(
margin, tab_bar.top, viewport_width - margin, tab_bar.bottom, s.columns, s.lines)
self.screen_geometry = sg = calculate_gl_geometry(g, vw, vh, cell_width, cell_height) self.screen_geometry = sg = calculate_gl_geometry(g, vw, vh, cell_width, cell_height)
self.update_blank_rects()
set_tab_bar_render_data(self.os_window_id, sg.xstart, sg.ystart, sg.dx, sg.dy, self.screen) set_tab_bar_render_data(self.os_window_id, sg.xstart, sg.ystart, sg.dx, sg.dy, self.screen)
def update(self, data: Sequence[TabBarData]) -> None: def update(self, data: Sequence[TabBarData]) -> None: