From ed870aaf10cce1a21935d8db7ca712caff8c69af Mon Sep 17 00:00:00 2001 From: Yihong Date: Mon, 27 Jul 2026 00:00:38 +0800 Subject: [PATCH] fix: ScrollableTextArea exit not responding to key press The check() function suspends the input handler task (xHandle) for ~10ms each time it is called. In ScrollableTextArea::show(), the update() function calls check() multiple times, creating brief windows where keyboard input is not being scanned. A quick tap of Enter during one of these suspension windows was silently swallowed, making the screen appear unresponsive. Fixed by: - Adding a 200ms delay before the wait loop to drain any buffered input - Adding EscPress as an alternative exit path (ESC key) --- src/core/scrollableTextArea.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/core/scrollableTextArea.cpp b/src/core/scrollableTextArea.cpp index 8197e72ae4..8d92f9b1a5 100644 --- a/src/core/scrollableTextArea.cpp +++ b/src/core/scrollableTextArea.cpp @@ -73,12 +73,14 @@ size_t ScrollableTextArea::getMaxLines() { return linesBuffer.size(); } void ScrollableTextArea::show(bool force) { draw(force); + delay(200); // drain input buffer - while (check(SelPress)) { - update(force); - yield(); - } + // Flush any stale SelPress + while (check(SelPress)) { update(force); } + + // Wait for SelPress or EscPress to exit while (!check(SelPress)) { + if (check(EscPress)) break; update(force); yield(); }