From 912bd0a8150e09cfe147c94fb615332ed43c26e2 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Tue, 25 Oct 2022 09:09:37 +0000 Subject: [PATCH] line_input(): cleanup --- mmgen/ui.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mmgen/ui.py b/mmgen/ui.py index a55ce05a..c39ac303 100755 --- a/mmgen/ui.py +++ b/mmgen/ui.py @@ -60,18 +60,16 @@ def line_input(prompt,echo=True,insert_txt='',hold_protect=True): from .term import kb_hold_protect kb_hold_protect() - readline = None - if g.test_suite_popen_spawn: msg(prompt) sys.stderr.flush() reply = os.read(0,4096).decode().rstrip('\n') # strip NL to mimic behavior of input() elif echo or not sys.stdin.isatty(): - readline = sys.stdin.isatty() and get_readline() - if readline and insert_txt: + readline = insert_txt and sys.stdin.isatty() and get_readline() + if readline: readline.set_startup_hook(lambda: readline.insert_text(insert_txt)) reply = input(prompt) - if readline and insert_txt: + if readline: readline.set_startup_hook(lambda: readline.insert_text('')) else: from getpass import getpass