ask kitten: Use the default value as input text

Prefill the current value when changing the tab title.
This commit is contained in:
pagedown
2022-01-22 03:11:39 +08:00
parent 7ce11050cd
commit 9a119255fe
2 changed files with 12 additions and 2 deletions

View File

@@ -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}