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