Dont create an extra OS Window when serializing
This commit is contained in:
parent
da7ac31258
commit
067afe35e4
2 changed files with 4 additions and 4 deletions
|
|
@ -507,9 +507,9 @@ def serialize_state_as_session(self) -> Iterator[str]:
|
|||
def skey(os_window_id: int) -> int:
|
||||
return s.get(os_window_id, 0)
|
||||
|
||||
for os_window_id in sorted(self.os_window_map, key=skey):
|
||||
for i, os_window_id in enumerate(sorted(self.os_window_map, key=skey)):
|
||||
tm = self.os_window_map[os_window_id]
|
||||
yield from tm.serialize_state_as_session()
|
||||
yield from tm.serialize_state_as_session(is_first=i==0)
|
||||
|
||||
@property
|
||||
def all_tab_managers(self) -> Iterator[TabManager]:
|
||||
|
|
|
|||
|
|
@ -1186,7 +1186,7 @@ def serialize_state(self) -> dict[str, Any]:
|
|||
'active_tab_idx': self.active_tab_idx,
|
||||
}
|
||||
|
||||
def serialize_state_as_session(self) -> list[str]:
|
||||
def serialize_state_as_session(self, is_first: bool = False) -> list[str]:
|
||||
ans = []
|
||||
hmap = {tab_id: i for i, tab_id in enumerate(self.active_tab_history)}
|
||||
at = self.active_tab
|
||||
|
|
@ -1197,7 +1197,7 @@ def skey(tab: Tab) -> int:
|
|||
for tab in sorted(self, key=skey):
|
||||
ans.extend(tab.serialize_state_as_session())
|
||||
if ans:
|
||||
prefix = ['new_os_window']
|
||||
prefix = [] if is_first else ['new_os_window']
|
||||
if self.wm_class:
|
||||
prefix.append(f'os_window_class {self.wm_class}')
|
||||
if self.wm_name:
|
||||
|
|
|
|||
Loading…
Reference in a new issue