Only update tab bar visibility after all tabs have been added from a session

Fixes #9382
This commit is contained in:
Kovid Goyal 2026-01-14 21:11:07 +05:30
parent fbd03de54c
commit 0cca5d1a10
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 11 additions and 8 deletions

View file

@ -181,6 +181,9 @@ Detailed list of changes
- Fix :ac:`goto_session` not respecting the focus_tab session directive when
creating a session in an existing OS window (:iss:`9366`)
- Fix another rendering glitch caused by :opt:`tab_bar_filter` when adding tabs
from a session (:iss:`9382`)
0.45.0 [2025-12-24]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View file

@ -1076,9 +1076,10 @@ class TabManager: # {{{
def add_tabs_from_session(self, session: SessionType, session_name: str = '') -> None:
active_tab = self.active_tab
added_tabs = []
visible_before = is_tab_bar_visible(self.os_window_id)
for i, t in enumerate(session.tabs):
tab = Tab(self, session_tab=t, session_name=session_name or self.created_in_session_name)
self._add_tab(tab)
self.tabs.append(tab)
added_tabs.append(tab)
if i == session.active_tab_idx:
active_tab = tab
@ -1108,6 +1109,8 @@ class TabManager: # {{{
# focus_tab.
if (at := self.active_tab) and (w := at.active_window):
w.last_focused_at = monotonic()
if visible_before != self.tab_bar_should_be_visible:
self.tabbar_visibility_changed()
@property
def active_tab_idx(self) -> int:
@ -1155,12 +1158,6 @@ class TabManager: # {{{
return True
return count < 1
def _add_tab(self, tab: Tab) -> None:
visible_before = is_tab_bar_visible(self.os_window_id)
self.tabs.append(tab)
if visible_before != self.tab_bar_should_be_visible:
self.tabbar_visibility_changed()
def _set_active_tab(self, idx: int, store_in_history: bool = True) -> None:
if store_in_history:
self.active_tab_idx = idx
@ -1405,7 +1402,8 @@ class TabManager: # {{{
if not empty_tab and session_name:
for w in t:
w.created_in_session_name = session_name
self._add_tab(t)
visible_before = is_tab_bar_visible(self.os_window_id)
self.tabs.append(t)
tabs = tabs + (t,)
if as_neighbor:
location = 'after'
@ -1425,6 +1423,8 @@ class TabManager: # {{{
swap_tabs(self.os_window_id, i, i-1)
idx = desired_idx
self._set_active_tab(idx)
if self.tab_bar_should_be_visible != visible_before:
self.tabbar_visibility_changed()
self.mark_tab_bar_dirty()
return t