This commit is contained in:
Kovid Goyal 2026-03-01 10:42:07 +05:30
parent 08d84aa211
commit 522aa7805b
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 6 additions and 9 deletions

View file

@ -815,15 +815,9 @@ class Tab: # {{{
overlay_for = window.id
def set_active_window(self, x: Window | int, for_keep_focus: Window | None = None) -> None:
if isinstance(x, int):
for q in self:
if q.id == x:
x = q
break
else:
return
self.windows.set_active_window_group_for(x, for_keep_focus=for_keep_focus)
self.windows.move_window_to_top_of_group(x)
if (w := self.windows.window_for_id(x) if isinstance(x, int) else x) is not None:
self.windows.set_active_window_group_for(w, for_keep_focus=for_keep_focus)
self.windows.move_window_to_top_of_group(w)
def get_nth_window(self, n: int) -> Window | None:
if self.windows:

View file

@ -340,6 +340,9 @@ class WindowList:
def num_groups(self) -> int:
return len(self.groups)
def window_for_id(self, x: int) -> WindowType | None:
return self.id_map.get(x)
def group_for_window(self, x: WindowOrId) -> WindowGroup | None:
q = self.id_map[x] if isinstance(x, int) else x
for g in self.groups: