fix(tui): reset leaked mouse tracking on startup#18902
fix(tui): reset leaked mouse tracking on startup#18902janah01 wants to merge 1 commit intoanomalyco:devfrom
Conversation
When a previous process is killed externally (TerminateProcess on Windows, SIGKILL on POSIX), mouse tracking can be left enabled in the terminal. Send disable sequences before the renderer configures its own mouse state to recover from a dirty baseline.
|
The following comment was made by an LLM, it may be inaccurate: Based on my search results, I found two related PRs that address similar mouse tracking issues in the TUI:
The current PR (18902) is complementary to these - it handles the startup side of the problem (resetting leaked modes from force-killed processes), while the previous PRs addressed the exit side. These could potentially be part of the same comprehensive fix for terminal mouse tracking state management. |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Issue for this PR
Closes #18901
Type of change
What does this PR do?
When the TUI is force-killed externally (
taskkill /Fon Windows,kill -9on POSIX), for instance when installing OpenCode Desktop while OpenCode CLI is running, mouse tracking stays enabled in the terminal. The nextopencodelaunch inherits this dirty state because the renderer starts from whatever baseline the terminal is already in.This sends
?1000l ?1002l ?1003l ?1006lon startup to clear any leaked mouse modes before the renderer sets up its own. Disabling already-disabled modes is a safe no-op.How did you verify your code works?
taskkill /F /PID, relaunch — terminal is clean/exit) — no change in behaviorScreenshots / recordings
N/A — not a UI change, terminal state fix.

Screenshot of the issue:
Checklist