Fix tab bar rendering

This commit is contained in:
Kovid Goyal 2017-09-07 09:05:26 +05:30
parent 914f7ddbd5
commit 079054f798
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -207,7 +207,7 @@ def __repr__(self):
class TabBar:
def __init__(self, data, opts):
def __init__(self, opts):
self.num_tabs = 1
self.cell_width = 1
self.vao_id = None
@ -222,7 +222,6 @@ def __init__(self, data, opts):
)
s.color_profile.dirty = True
self.blank_rects = ()
self.current_data = data
def as_rgb(x):
return (x << 8) | 2
@ -254,10 +253,10 @@ def update(self, data):
s = self.screen
s.cursor.x = 0
s.erase_in_line(2, False)
max_title_length = (self.screen_geometry.xnum // max(1, len(self.current_data)) - 1)
max_title_length = (self.screen_geometry.xnum // max(1, len(data))) - 1
cr = []
for t in self.current_data:
for t in data:
s.cursor.bg = self.active_bg if t.is_active else 0
s.cursor.fg = self.active_fg if t.is_active else 0
s.cursor.bold = s.cursor.italic = t.is_active
@ -305,7 +304,7 @@ class TabManager:
def __init__(self, opts, args):
self.opts, self.args = opts, args
self.tabs = []
self.tab_bar = TabBar(self.tab_bar_data, opts)
self.tab_bar = TabBar(opts)
self.tab_bar.layout(*self.tab_bar_layout_data)
self.active_tab_idx = 0