turbo
6b83585d - fix: Flush stale mouse tracking events from stdin during TUI cleanup (#12311)

Commit
49 days ago
fix: Flush stale mouse tracking events from stdin during TUI cleanup (#12311) ## Summary - Fixes raw SGR mouse escape sequences (`^[[<35;XX;YYM`) leaking to the terminal after the TUI exits ## Problem When the TUI shuts down, there's a race between `DisableMouseCapture` (sent to stdout) and `disable_raw_mode()` (re-enables echo via `tcsetattr`). Mouse motion events generated in that window sit in the kernel's stdin buffer and get echoed as visible garbage once echo is restored. This is most noticeable when turbo runs inside git hooks (e.g. pre-push) where the user is likely moving the mouse during the run. ## Fix Call `tcflush(stdin, TCIFLUSH)` right before `disable_raw_mode()` to discard any stale input. By this point, `DisableMouseCapture` was sent well before (during `persist_tasks`), so the terminal has had time to stop generating events. Applied to both the normal `cleanup()` path and the `restore_terminal_on_panic()` path.
Author
Parents
Loading