fix: restore mouse state after ExecProcess#1583
Open
veeceey wants to merge 1 commit intocharmbracelet:mainfrom
Open
fix: restore mouse state after ExecProcess#1583veeceey wants to merge 1 commit intocharmbracelet:mainfrom
veeceey wants to merge 1 commit intocharmbracelet:mainfrom
Conversation
ReleaseTerminal saves bracketed paste, alt screen, and focus reporting state so they can be re-enabled by RestoreTerminal (used by ExecProcess to run external commands). However, mouse mode state (cell motion and all motion tracking) was not saved or restored, causing mouse events to stop working after returning from an exec'd process like vim. This adds mouse state tracking to the renderer and saves/restores it across ReleaseTerminal/RestoreTerminal, fixing the issue. Fixes charmbracelet#1424 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Author
|
Friendly ping - any chance someone could take a look at this when they get a chance? Happy to make any changes if needed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tea.ExecProcess(e.g., spawning vim from a TUI program)ReleaseTerminalalready saved and restored bracketed paste, alt screen, and focus reporting state, but mouse mode was missing from this save/restore cycleReleaseTerminal/RestoreTerminalFixes #1424
What changed
renderer.go: AddedmouseCellMotionActive()andmouseAllMotionActive()to the renderer interfacestandard_renderer.go: AddedmouseCellMotionandmouseAllMotionboolean fields, updated enable/disable methods to track state, added getter methodsnil_renderer.go: Implemented the new interface methods (always return false)tea.go: AddedmouseCellMotionWasActiveandmouseAllMotionWasActivefields toProgram;ReleaseTerminalnow saves mouse state;RestoreTerminalnow re-enables mouse mode (including SGR extended mode) when it was previously activescreen_test.go/nil_renderer_test.go: Added tests for mouse state trackingTest plan
go test ./...)go vet ./...passes cleanlyTestMouseStateTrackingtest verifies enable/disable state tracking on the standard renderer🤖 Generated with Claude Code