Start cleanup of previous PR

This commit is contained in:
Kovid Goyal 2026-03-28 10:19:45 +05:30
parent 9e79d3be9c
commit 8af6fceb2f
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 11 additions and 4 deletions

View file

@ -3325,8 +3325,7 @@ class Boss:
tab.relayout()
def _insert_window_in_direction(
self, window: Window, dest_window: Window,
direction: str
self, window: Window, dest_window: Window, direction: Literal['left', 'right', 'top', 'bottom'],
) -> None:
src_tab = window.tabref()
dest_tab = dest_window.tabref()

View file

@ -1113,6 +1113,14 @@ class Tab: # {{{
tm = self.tab_manager_ref()
if tm is not None:
tm.set_active_tab(self)
def swap_windows(self, window_a: Window, window_b: Window) -> None:
if (wg_b := self.windows.group_for_window(window_b)) is None:
return
with get_boss().suppress_focus_change_events():
self.windows.set_active_window_group_for(window_a)
self.current_layout.move_window_to_group(self.windows, wg_b.id)
self.relayout()
# }}}
@ -2024,9 +2032,9 @@ class TabManager: # {{{
return
if dest_in_title_bar:
if w.tabref() is dest_window.tabref():
if (src_tab := w.tabref()) is dest_window.tabref() and src_tab is not None:
# Same tab: swap positions
boss._swap_windows(w, dest_window)
src_tab.swap_windows(w, dest_window)
else:
# Cross-tab title bar drop: move to the destination tab
boss._move_window_to(w, target_tab_id=active_tab.id)