fix(tui): flush input buffer on init to prevent early exit on Windows (#10729)

Fixes #10661.

### Problem
On Windows, the sign-in menu can exit immediately if the OS-level input
buffer contains trailing characters (like the Enter key from running the
command).

### Solution
**Flush Input Buffer on Init**: Use FlushConsoleInputBuffer on Windows
(and cflush on Unix) in ui::init() to discard any input captured before
the TUI was ready.

Verified by @CodebyAmbrose in #10661.
This commit is contained in:
Ashutosh Kumar Singh 2026-02-05 14:29:32 +05:30 committed by GitHub
parent fe8b474acd
commit 7b28b350e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -214,6 +214,8 @@ pub fn init() -> Result<Terminal> {
}
set_modes()?;
flush_terminal_input_buffer();
set_panic_hook();
let backend = CrosstermBackend::new(stdout());