mirror of
https://github.com/kovidgoyal/kitty.git
synced 2025-12-13 20:36:22 +01:00
Ensure tab active window is correct after detach
This commit is contained in:
@@ -407,6 +407,7 @@ detach_window(id_type os_window_id, id_type tab_id, id_type id) {
|
||||
add_detached_window(tab->windows + i);
|
||||
zero_at_i(tab->windows, i);
|
||||
remove_i_from_array(tab->windows, i, tab->num_windows);
|
||||
if (tab->active_window >= tab->num_windows) tab->active_window = tab->num_windows ? tab->num_windows - 1 : 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -526,12 +527,16 @@ set_active_tab(id_type os_window_id, unsigned int idx) {
|
||||
|
||||
static void
|
||||
set_active_window(id_type os_window_id, id_type tab_id, id_type window_id) {
|
||||
WITH_WINDOW(os_window_id, tab_id, window_id)
|
||||
(void)window;
|
||||
tab->active_window = w;
|
||||
WITH_TAB(os_window_id, tab_id)
|
||||
tab->active_window = 0;
|
||||
for (unsigned w = 0; w < tab->num_windows; w++) {
|
||||
if (tab->windows[w].id == window_id) {
|
||||
tab->active_window = w; break;
|
||||
}
|
||||
}
|
||||
osw->needs_render = true;
|
||||
set_os_window_chrome(osw);
|
||||
END_WITH_WINDOW;
|
||||
END_WITH_TAB;
|
||||
}
|
||||
|
||||
static bool
|
||||
|
||||
@@ -747,6 +747,7 @@ class Tab: # {{{
|
||||
active_window = self.active_window
|
||||
if active_window:
|
||||
self.title_changed(active_window)
|
||||
set_active_window(self.os_window_id, self.id, active_window.id if active_window else 0)
|
||||
|
||||
def detach_window(self, window: Window) -> tuple[Window, ...]:
|
||||
windows = list(self.windows.windows_in_group_of(window))
|
||||
|
||||
Reference in New Issue
Block a user