mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-08-03 22:25:57 +00:00
parent
65923b1aba
commit
76a4840a0f
3 changed files with 28 additions and 2 deletions
|
|
@ -73,6 +73,8 @@ Detailed list of changes
|
|||
|
||||
- icat kitten: Add a command line argument to override terminal window size detection (:iss:`7165`)
|
||||
|
||||
- A new action :ac:`toggle_tab` to easily switch to and back from a tab with a single shortcut (:iss:`7203`)
|
||||
|
||||
- When :ac:`clearing terminal <clear_terminal>` add a new type ``to_cursor_scroll`` which can be
|
||||
used to clear to prompt while moving cleared lines into the scrollback
|
||||
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ def detach_tab_parse(func: str, rest: str) -> FuncArgsType:
|
|||
return func, (rest,)
|
||||
|
||||
|
||||
@func_with_args('set_background_opacity', 'goto_layout', 'toggle_layout', 'kitty_shell', 'show_kitty_doc', 'set_tab_title', 'push_keyboard_mode')
|
||||
@func_with_args('set_background_opacity', 'goto_layout', 'toggle_layout', 'toggle_tab', 'kitty_shell', 'show_kitty_doc', 'set_tab_title', 'push_keyboard_mode')
|
||||
def simple_parse(func: str, rest: str) -> FuncArgsType:
|
||||
return func, [rest]
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import stat
|
|||
import weakref
|
||||
from collections import deque
|
||||
from contextlib import suppress
|
||||
from gettext import gettext as _
|
||||
from operator import attrgetter
|
||||
from time import monotonic
|
||||
from typing import (
|
||||
|
|
@ -870,7 +871,6 @@ class TabManager: # {{{
|
|||
self.wm_class = wm_class
|
||||
self.recent_mouse_events: Deque[TabMouseEvent] = deque()
|
||||
self.wm_name = wm_name
|
||||
self.last_active_tab_id = None
|
||||
self.args = args
|
||||
self.tab_bar_hidden = get_options().tab_bar_style == 'hidden'
|
||||
self.tabs: List[Tab] = []
|
||||
|
|
@ -990,6 +990,30 @@ class TabManager: # {{{
|
|||
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:
|
||||
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
|
||||
|
||||
def tab_at_location(self, loc: str) -> Optional[Tab]:
|
||||
if loc == 'prev':
|
||||
if self.active_tab_history:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue