fix(tui): restore terminal modes on exit#20199
fix(tui): restore terminal modes on exit#20199timrichardson wants to merge 1 commit intoanomalyco:devfrom
Conversation
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: Found a potentially related PR: PR #18902: fix(tui): reset leaked mouse tracking on startup This is related because it addresses a similar issue with mouse tracking/SGR mouse mode being leaked in the terminal. While PR #18902 fixes the issue on startup (detecting and cleaning up leaked state), PR #20199 proactively prevents the leak by properly restoring terminal modes on exit. These are complementary approaches to the same problem. |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
this fix is not working reliably |
Issue for this PR
Closes #20207
Type of change
What does this PR do?
This fixes a TUI shutdown cleanup bug that can leave terminal mouse-reporting modes enabled after exit.
The change adds a shared terminal restore step that disables common mouse modes, disables bracketed paste, and restores cursor visibility. That restore step now runs around renderer teardown in both the normal exit path and the fatal-error exit path.
This matches the Linux issue in #20207 and is closely related to the Windows report in #11748. It also complements #18902, which resets leaked mouse tracking on startup after hard-kill scenarios.
How did you verify your code works?
cd packages/opencode && bun typecheckpassesScreenshots / recordings
Not a UI change.
Checklist