From 0fe39703afaab2176e8aed9c8e8e10c02f637f83 Mon Sep 17 00:00:00 2001 From: "motty.mio2" Date: Thu, 14 Apr 2022 13:07:06 +0900 Subject: [PATCH 1/2] add default_value option in dialog --- src/prompt_toolkit/shortcuts/dialogs.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/prompt_toolkit/shortcuts/dialogs.py b/src/prompt_toolkit/shortcuts/dialogs.py index 9140f86ab..0fcb155ff 100644 --- a/src/prompt_toolkit/shortcuts/dialogs.py +++ b/src/prompt_toolkit/shortcuts/dialogs.py @@ -109,6 +109,7 @@ def input_dialog( validator: Optional[Validator] = None, password: FilterOrBool = False, style: Optional[BaseStyle] = None, + default_text: str = "", ) -> Application[str]: """ Display a text input box. @@ -126,6 +127,7 @@ def ok_handler() -> None: cancel_button = Button(text=cancel_text, handler=_return_none) textfield = TextArea( + text=default_text, multiline=False, password=password, completer=completer, From 651a8269fd85d628498f9e73114771e8dffc4a29 Mon Sep 17 00:00:00 2001 From: "motty.mio2" Date: Wed, 20 Apr 2022 15:10:50 +0900 Subject: [PATCH 2/2] change argument to default --- src/prompt_toolkit/shortcuts/dialogs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/prompt_toolkit/shortcuts/dialogs.py b/src/prompt_toolkit/shortcuts/dialogs.py index 0fcb155ff..eacb05a00 100644 --- a/src/prompt_toolkit/shortcuts/dialogs.py +++ b/src/prompt_toolkit/shortcuts/dialogs.py @@ -109,7 +109,7 @@ def input_dialog( validator: Optional[Validator] = None, password: FilterOrBool = False, style: Optional[BaseStyle] = None, - default_text: str = "", + default: str = "", ) -> Application[str]: """ Display a text input box. @@ -127,7 +127,7 @@ def ok_handler() -> None: cancel_button = Button(text=cancel_text, handler=_return_none) textfield = TextArea( - text=default_text, + text=default, multiline=False, password=password, completer=completer,