From ec6910074f5fcb4cf99ef6ae562b34b8797fafe2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 30 Sep 2025 08:49:31 +0530 Subject: [PATCH] Avoid quadratic algorithm --- kitty/tabs.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kitty/tabs.py b/kitty/tabs.py index 8f2c0a321..fbcc17827 100644 --- a/kitty/tabs.py +++ b/kitty/tabs.py @@ -268,9 +268,10 @@ def _startup(self, session_tab: SessionTab) -> None: if window.focus_matching_window_spec: # include windows from this tab when matching windows all_windows = list(boss.all_windows) - all_windows.extend(w for w in self if w not in all_windows) + awq = {w.id for w in all_windows} + all_windows.extend(w for w in self if w.id not in awq) for w in boss.match_windows( - window.focus_matching_window_spec, launched_window or boss.active_window, all_windows + window.focus_matching_window_spec, launched_window or boss.active_window, all_windows ): tab = w.tabref() if tab: