You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TUI mouse control characters appear after CTRL+C with --continue #16564
When using TUI with --continue multiple times and exiting with CTRL+C, mouse control characters appear on subsequent runs in certain terminal emulators. The terminal enters an inconsistent state where mouse movements produce escape sequences.
Expected Behavior
Terminal should remain in consistent state after CTRL+C exit. Mouse control characters should not appear on subsequent runs.
Actual Behavior
After exiting with CTRL+C and restarting with --continue, mouse movements produce escape sequences like:
^[[<35;9734M
^[[<35;9834M
^[[<35;9934M
The characters vary depending on mouse position and movement direction.
Affected Environments
This issue only occurs in certain terminal emulators. Tested and confirmed affected:
Windows with MinTTY
Windows with PuTTY
Other terminal emulators with incomplete TTY state restoration
Root Cause
The problematic commit 3ebebe0 introduced a try/finally block around tui() call that caused double cleanup:
consttuiPromise=tui({
...,onExit: stop,})try{awaittui({...,onExit: stop})}finally{awaitstop()// Called again!}
When CTRL+C is pressed:
onExit: stop is called inside tui()
finally { await stop() } is called outside tui()
This double cleanup corrupts the TTY state, leaving mouse tracking active when it should be disabled. Some terminal emulators are more sensitive to this TTY state corruption than others.
Related Issues
This issue prevents proper usage of the TUI across multiple sessions with --continue in certain terminal environments.
Plugins
none during debugging
OpenCode version
1.2.17, 1.2.18, 1.2.19, 1.2.20, 1.2.21, dev
Steps to reproduce
Run opencode TUI with --continue
Exit with CTRL+C
Run opencode TUI again with --continue
Observe mouse control characters appearing when moving the mouse
This issue might be a duplicate of an existing issue. Please check:
TUI broken in tmux after 1.2.17 (found root cause) #16351: Same root cause commit (3ebebe0a9) identified, same symptom of mouse escape sequences being injected into the TUI after CTRL+C exit — that issue also notes the double-cleanup/TTY corruption pattern and affects the same version range (1.2.17+). The main difference here is the Windows terminal emulator context (MinTTY, PuTTY).
You may want to add your findings there or reference it, as the fix tracked in #16351 would likely resolve this as well.
Activity
github-actions commentedon Mar 8, 2026
This issue might be a duplicate of an existing issue. Please check:
3ebebe0a9) identified, same symptom of mouse escape sequences being injected into the TUI afterCTRL+Cexit — that issue also notes the double-cleanup/TTY corruption pattern and affects the same version range (1.2.17+). The main difference here is the Windows terminal emulator context (MinTTY, PuTTY).You may want to add your findings there or reference it, as the fix tracked in #16351 would likely resolve this as well.