DRYer
This commit is contained in:
@@ -38,23 +38,23 @@ from .utils import color_as_int, log_error, sgr_sanitizer_pat
|
||||
|
||||
class TabBarData(NamedTuple):
|
||||
title: str
|
||||
is_active: bool
|
||||
needs_attention: bool
|
||||
tab_id: int
|
||||
os_window_id: int
|
||||
num_windows: int
|
||||
num_window_groups: int
|
||||
layout_name: str
|
||||
has_activity_since_last_focus: bool
|
||||
active_fg: int | None
|
||||
active_bg: int | None
|
||||
inactive_fg: int | None
|
||||
inactive_bg: int | None
|
||||
num_of_windows_with_progress: int
|
||||
total_progress: int
|
||||
last_focused_window_with_progress_id: int
|
||||
session_name: str
|
||||
active_session_name: str
|
||||
is_active: bool = False
|
||||
needs_attention: bool = False
|
||||
tab_id: int = -1
|
||||
os_window_id: int = 0
|
||||
num_windows: int = 0
|
||||
num_window_groups: int = 0
|
||||
layout_name: str = ''
|
||||
has_activity_since_last_focus: bool = False
|
||||
active_fg: int | None = None
|
||||
active_bg: int | None = None
|
||||
inactive_fg: int | None = None
|
||||
inactive_bg: int | None = None
|
||||
num_of_windows_with_progress: int = 0
|
||||
total_progress: int = 0
|
||||
last_focused_window_with_progress_id: int = 0
|
||||
session_name: str = ''
|
||||
active_session_name: str = ''
|
||||
|
||||
|
||||
class DrawData(NamedTuple):
|
||||
|
||||
@@ -1602,12 +1602,6 @@ class TabManager: # {{{
|
||||
self.mark_tab_bar_dirty()
|
||||
removed_tab.destroy()
|
||||
|
||||
def _new_tab_drop_indicator(self) -> TabBarData:
|
||||
return TabBarData(
|
||||
'+', self.window_drag_target_tab_id == -1, False, -1, self.os_window_id,
|
||||
0, 0, '', False, None, None, None, None, 0, 0, 0, '', '',
|
||||
)
|
||||
|
||||
@property
|
||||
def tab_bar_data(self) -> Sequence[TabBarData]:
|
||||
at = self.active_tab
|
||||
@@ -1623,7 +1617,8 @@ class TabManager: # {{{
|
||||
else:
|
||||
tabs = tuple(t.data_for_tab_bar(t is at or t.id == wdtt) for t in self.tabs_to_be_shown_in_tab_bar)
|
||||
if window_drag_active or get_options().tab_bar_show_new_tab_button:
|
||||
tabs = tabs + (self._new_tab_drop_indicator(),)
|
||||
tabs = tabs + (TabBarData(
|
||||
title='+', is_active=self.window_drag_target_tab_id == -1, os_window_id=self.os_window_id),)
|
||||
return tabs
|
||||
tmap = {t.id:t for t in self.tabs}
|
||||
at = self.active_tab
|
||||
|
||||
Reference in New Issue
Block a user