From 8c9a782dfe94525dc5f0893c98fd19543648264b Mon Sep 17 00:00:00 2001 From: historia Date: Tue, 25 Aug 2026 19:03:09 -0400 Subject: fix: tui errors wait for getch() --- app/ui/tui.py | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'app/ui/tui.py') diff --git a/app/ui/tui.py b/app/ui/tui.py index d675946..b1b18f1 100644 --- a/app/ui/tui.py +++ b/app/ui/tui.py @@ -123,17 +123,22 @@ def flash(scr, text: str, kind: str = "warn") -> None: Used by the hub for "not set up yet"-style messages. KIND is a theme key (warn/err/ok/info). The notice itself is the dialog's only content (no "Notice" heading); Esc dismisses it (it does not abort). + A timed-out getch (-1; the screen may still be in a redraw cadence) + is ignored so the notice really waits for a key. """ frame = Frame(scr, "", "Press any key to continue Esc = back") frame.mark(text, frame.theme.get(kind, frame.theme["body"])) frame.cursor = None frame.draw() - try: - key = scr.getch() - except KeyboardInterrupt: - raise WizardCancelled() from None - if key == 3: # Ctrl-C still aborts - raise WizardCancelled() + while True: + try: + key = scr.getch() + except KeyboardInterrupt: + raise WizardCancelled() from None + if key == 3: # Ctrl-C still aborts + raise WizardCancelled() + if key != -1: + return # On screens without typed text, Esc and 'q' mean the same thing: go @@ -581,12 +586,15 @@ class Frame: """Show TEXT on the status line until any key is pressed.""" self.status = (text, kind) self.draw() - try: - key = self.scr.getch() - if key == 3: # Ctrl-C still aborts - raise WizardCancelled() - except KeyboardInterrupt: - raise WizardCancelled() from None + while True: + try: + key = self.scr.getch() + if key == 3: # Ctrl-C still aborts + raise WizardCancelled() + except KeyboardInterrupt: + raise WizardCancelled() from None + if key != -1: + break self.status = None def edit_status(self, prompt: str = "") -> Optional[str]: -- cgit v1.2.3