1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
from kitty.fast_data_types import Screen
from kitty.tab_bar import DrawData, ExtraData, TabBarData, draw_title
def draw_tab(
draw_data: DrawData, screen: Screen, tab: TabBarData,
before: int, max_tab_length: int, index: int, is_last: bool,
extra_data: ExtraData
) -> int:
transparent = 0
orig_bg = screen.cursor.bg
orig_fg = screen.cursor.fg
screen.cursor.bg = 0
screen.cursor.fg = orig_bg
screen.draw('◖')
screen.cursor.bg = orig_bg
screen.cursor.fg = orig_fg
draw_title(draw_data, screen, tab, index, max_tab_length)
trailing_spaces = min(max_tab_length - 1, draw_data.trailing_spaces)
max_tab_length -= trailing_spaces
extra = screen.cursor.x - before - max_tab_length
if extra > 0:
screen.cursor.x -= extra + 1
screen.draw('…')
screen.cursor.bg = 0
screen.cursor.fg = orig_bg
screen.draw('◗ ')
end = screen.cursor.x
screen.cursor.bold = screen.cursor.italic = False
screen.cursor.fg = 0
screen.cursor.bg = 0
return end
|