mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-09-21 12:17:14 +00:00
When serializing windows in a tab keep the window order
This is needed because layouts other than split use the window order to position windows. Maybe should serialize active history in layout state, but I dont think it's that important.
This commit is contained in:
parent
3aff57933a
commit
214dc73c52
2 changed files with 6 additions and 8 deletions
|
|
@ -292,13 +292,17 @@ class Tab: # {{{
|
|||
def serialize_state_as_session(self) -> list[str]:
|
||||
import shlex
|
||||
launch_cmds = []
|
||||
for g in self.windows.iter_groups_in_activation_order():
|
||||
active_idx = self.windows.active_group_idx
|
||||
for i, g in enumerate(self.windows.iter_all_layoutable_groups()):
|
||||
gw: list[str] = []
|
||||
for window in g:
|
||||
lc = window.as_launch_command(is_overlay=bool(gw))
|
||||
if lc:
|
||||
gw.append(shlex.join(lc))
|
||||
launch_cmds.extend(gw)
|
||||
if gw:
|
||||
launch_cmds.extend(gw)
|
||||
if i == active_idx:
|
||||
launch_cmds.append('focus')
|
||||
if launch_cmds:
|
||||
return [
|
||||
f'new_tab {self.name}'.rstrip(),
|
||||
|
|
|
|||
|
|
@ -333,12 +333,6 @@ class WindowList:
|
|||
return
|
||||
self.set_active_group_idx(len(self.groups) - 1, notify=notify)
|
||||
|
||||
def iter_groups_in_activation_order(self) -> Iterator[WindowGroup]:
|
||||
imap = {gid: i for i, gid in enumerate(self.active_group_history)}
|
||||
def skey(g: WindowGroup) -> int:
|
||||
return imap.get(g.id, -1)
|
||||
yield from sorted(self.groups, key=skey)
|
||||
|
||||
@property
|
||||
def num_groups(self) -> int:
|
||||
return len(self.groups)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue