ask kitten: Use the default value as input text
Prefill the current value when changing the tab title.
This commit is contained in:
parent
7ce11050cd
commit
9a119255fe
@ -298,7 +298,15 @@ def main(args: List[str]) -> Response:
|
||||
|
||||
prompt = '> '
|
||||
with suppress(KeyboardInterrupt, EOFError):
|
||||
response = input(prompt)
|
||||
if cli_opts.default:
|
||||
def prefill_text():
|
||||
readline.insert_text(cli_opts.default)
|
||||
readline.redisplay()
|
||||
readline.set_pre_input_hook(prefill_text)
|
||||
response = input(prompt)
|
||||
readline.set_pre_input_hook()
|
||||
else:
|
||||
response = input(prompt)
|
||||
return {'items': items, 'response': response}
|
||||
|
||||
|
||||
|
||||
@ -1418,7 +1418,9 @@ class Boss:
|
||||
def set_tab_title(self) -> None:
|
||||
tab = self.active_tab
|
||||
if tab:
|
||||
args = ['--name=tab-title', '--message', _('Enter the new title for this tab below.'), 'do_set_tab_title', str(tab.id)]
|
||||
args = [
|
||||
'--name=tab-title', '--message', _('Enter the new title for this tab below.'),
|
||||
'--default', tab.name or tab.title, 'do_set_tab_title', str(tab.id)]
|
||||
self._run_kitten('ask', args)
|
||||
|
||||
def do_set_tab_title(self, title: str, tab_id: int) -> None:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user