mirror of
https://github.com/anomalyco/opentui.git
synced 2026-04-24 20:45:56 +03:00
[PR #802] fix: disable mouse tracking before restoring cooked mode in finalizeDestroy #1575
Labels
No labels
bug
core
documentation
feature
good first issue
help wanted
pull-request
question
react
solid
tmux
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/opentui#1575
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/anomalyco/opentui/pull/802
Author: @adyavanapalli
Created: 3/11/2026
Status: 🔄 Open
Base:
main← Head:fix/disable-mouse-before-cooked-mode📝 Commits (1)
ecd5fe1fix: disable mouse tracking before restoring cooked mode in finalizeDestroy📊 Changes
1 file changed (+8 additions, -1 deletions)
View changed files
📝
packages/core/src/renderer.ts(+8 -1)📄 Description
Summary
35;80;40M) appearing on the shell prompt after renderer destroyProblem
When
finalizeDestroy()tears down the renderer, it callssetRawMode(false)before mouse tracking has been disabled. In the window between restoring cooked mode anddestroyRenderer()sending the mouse disable sequences, any mouse movement generates SGR escape events (\x1b[<35;80;40M) from the terminal. Since raw mode is off and the stdin listener has been removed, the terminal echoes these as visible garbage on the user's prompt.This is easily reproduced in OpenCode:
/exitwhile moving the mouse, and partial escape sequence bytes print after the shell prompt.https://github.com/user-attachments/assets/8d481504-727e-4519-ad11-683f8f96c765
Fix
Call
disableMouse()beforesetRawMode(false)infinalizeDestroy(), matching the ordering already used insuspend()(which does not have this bug).The corrected sequence:
disableMouse()— sends\x1b[?1000l,\x1b[?1002l,\x1b[?1006lwhile still in raw modesetRawMode(false)— restore cooked mode only after mouse tracking is offdestroyRenderer()— clean up native resources🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.