Skip to content

Commit

Permalink
fix(tree): make title_provider invocation resilient to restoration
Browse files Browse the repository at this point in the history
  • Loading branch information
aravinda0 committed Jun 12, 2024
1 parent 8ef1033 commit 86afce3
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/qtile_bonsai/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ def render(self, screen_rect: ScreenRect):
tab_bar_border_color: str = tree.get_config("tab_bar.border_color", level=level)
tab_bar_bg_color: str = tree.get_config("tab_bar.bg_color", level=level)

tab_width: int | str = tree.get_config("tab_bar.tab.width", level=level)
tab_margin: int = tree.get_config("tab_bar.tab.margin", level=level)
tab_padding: int = tree.get_config("tab_bar.tab.padding", level=level)
tab_font_family: str = tree.get_config("tab_bar.tab.font_family", level=level)
Expand Down Expand Up @@ -137,11 +136,11 @@ def render(self, screen_rect: ScreenRect):

tab_box = self._get_object_space_tab_box(i, per_tab_w)

tab_title = f"{i + 1}: {tab.title}" if tab.title else f"{i + 1}"
if tab_title_provider is not None:
active_pane = tree.find_mru_pane(start_node=tab)
tab_title = tab_title_provider(i, active_pane, tab)
else:
tab_title = f"{i + 1}: {tab.title}" if tab.title else f"{i + 1}"
if active_pane.window is not None:
tab_title = tab_title_provider(i, active_pane, tab)
if len(tab_title) > per_tab_max_chars:
tab_title = f"{tab_title[:per_tab_max_chars - 1]}…"

Expand Down

0 comments on commit 86afce3

Please sign in to comment.