Allow resetting the tab title to default

This commit is contained in:
Kovid Goyal 2022-08-29 20:41:07 +05:30
parent 5b28aed0b1
commit 6253ee2a74
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -1580,14 +1580,25 @@ def input_unicode_character(self) -> None:
self.run_kitten_with_metadata('unicode_input')
@ac(
'tab',
'Change the title of the active tab interactively, by typing in the new title. If you specify an argument'
' to this action then that is used as the title instead of asking for it.'
'tab', '''
Change the title of the active tab interactively, by typing in the new title.
If you specify an argument to this action then that is used as the title instead of asking for it.
Use the empty string ("") to reset the title to default. For example::
# interactive usage
map f1 set_tab_title
# set a specific title
map f2 set_tab_title some title
# reset to default
map f3 set_tab_title ""
'''
)
def set_tab_title(self, title: str = '') -> None:
def set_tab_title(self, title: Optional[str] = None) -> None:
tab = self.active_tab
if tab:
if title:
if title is not None:
if title in ('""', "''"):
title = ''
tab.set_title(title)
return
args = [