From d33afd4e96cb6b9f84512568ce97816257a256c4 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 7 Mar 2024 11:57:07 +0530 Subject: [PATCH] Move toggle_tab into Boss actions arent supported on TabManager --- kitty/boss.py | 16 ++++++++++++++++ kitty/tabs.py | 11 ----------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/kitty/boss.py b/kitty/boss.py index 9762a2049..1d48266f2 100644 --- a/kitty/boss.py +++ b/kitty/boss.py @@ -2930,3 +2930,19 @@ def sanitize_url_for_dispay_to_user(self, url: str) -> str: def on_system_color_scheme_change(self, appearance: int) -> None: log_error('system color theme changed:', appearance) + + @ac('win', ''' + Toggle to the tab matching the specified expression + + Switches to the matching tab if another tab is current, otherwise + switches to the last used tab. Useful to easily switch to and back from a + tab using a single shortcut. Note that toggling works only between + tabs in the same OS window. See :ref:`search_syntax` for details + on the match expression. For example:: + + map f1 toggle_tab title:mytab + ''') + def toggle_tab(self, match_expression: str) -> None: + tm = self.active_tab_manager + if tm is not None: + tm.toggle_tab(match_expression) diff --git a/kitty/tabs.py b/kitty/tabs.py index 53970cc7f..bca60dccd 100644 --- a/kitty/tabs.py +++ b/kitty/tabs.py @@ -990,17 +990,6 @@ def next_tab(self, delta: int = 1) -> None: if len(self.tabs) > 1: self.set_active_tab_idx((self.active_tab_idx + len(self.tabs) + delta) % len(self.tabs)) - @ac('win', ''' - Toggle to the tab matching the specified expression - - Switches to the matching tab if another tab is current, otherwise - switches to the last used tab. Useful to easily switch to and back from a - tab using a single shortcut. Note that toggling works only between - tabs in the same OS window. See :ref:`search_syntax` for details - on the match expression. For example:: - - map f1 toggle_tab title:mytab - ''') def toggle_tab(self, match_expression: str) -> None: tabs = set(get_boss().match_tabs(match_expression)) & set(self) if not tabs: