From 7bd912c093c6c360c762430d2540f8070cc97606 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 23 Aug 2025 14:15:40 +0530 Subject: [PATCH] Micro optimization using the new ability to specify all_set --- kitty/tabs.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/kitty/tabs.py b/kitty/tabs.py index c242fa692..5aa58e92f 100644 --- a/kitty/tabs.py +++ b/kitty/tabs.py @@ -1153,17 +1153,16 @@ class TabManager: # {{{ self.set_active_tab_idx((self.active_tab_idx + len(self.tabs) + delta) % len(self.tabs)) def toggle_tab(self, match_expression: str) -> None: - tabs = set(get_boss().match_tabs(match_expression)) & set(self) + tabs = set(get_boss().match_tabs(match_expression, all_tabs=self)) if not tabs: get_boss().show_error(_('No matching tab'), _('No tab found matching the expression: {}').format(match_expression)) return if self.active_tab and self.active_tab in tabs: self.goto_tab(-1) else: - for x in self: - if x in tabs: - self.set_active_tab(x) - break + for x in tabs: + self.set_active_tab(x) + break def tab_at_location(self, loc: str) -> Tab | None: if loc == 'prev':