Repository navigation
fix(ui): Restore mouse after editor return - #235
Conversation
Ctrl+E annotation editing releases the terminal to the external editor. Bubble Tea disables mouse tracking during that release, then restores the terminal without re-emitting the mouse-enable sequence. After returning from the editor, wheel events therefore stay with the terminal instead of reaching revdiff. Mark editor sessions that actually passed through Bubble Tea's process handoff, and re-enable mouse cell tracking when those sessions complete for sessions that started with mouse tracking enabled. Editor setup failures keep their existing retry behavior without requesting mouse restoration, and `--no-mouse` sessions do not gain mouse tracking after editor return. The regression test covers the editor-completion path that must request mouse tracking after a successful handoff.
|
This change is part of the following stack: Change managed by git-spice. |
There was a problem hiding this comment.
Pull request overview
Fixes a UI regression where mouse tracking is not re-enabled after returning from an external editor session (Ctrl+E), causing mouse events to be handled by the terminal instead of revdiff. The change threads an explicit “restore mouse” flag through the editor completion message and re-emits Bubble Tea’s mouse-enable command only for sessions that originally started with mouse tracking enabled.
Changes:
- Add a
MouseTrackingconfig flag to the UI model so editor sessions can know whether mouse tracking was enabled at startup. - Mark editor sessions that went through
tea.ExecProcesscompletion to request mouse restoration on return. - Re-enable mouse cell-motion tracking on editor completion (and add targeted tests for both enabled/disabled cases).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| app/ui/model.go | Adds internal model state + config field to remember whether mouse tracking was enabled for the session. |
| app/ui/editor.go | Propagates a restore-mouse marker through editorFinishedMsg and returns tea.EnableMouseCellMotion when appropriate. |
| app/ui/editor_test.go | Adds unit tests asserting the returned command is emitted only when restoration is requested. |
| app/main.go | Wires MouseTracking from CLI option --no-mouse into ui.ModelConfig. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
umputun
left a comment
There was a problem hiding this comment.
lgtm. Verified the diagnosis against vendored bubbletea - RestoreTerminal re-enables altscreen/bracketed-paste/report-focus but never mouse, so the fix targets the real gap, and gating on mouseTracking keeps --no-mouse correct.
Bug:
Ctrl+E annotation editing releases the terminal to the external editor.
Bubble Tea disables mouse tracking during that release,
then restores the terminal without re-emitting the mouse-enable sequence.
After returning from the editor,
events therefore stay with the terminal instead of reaching revdiff.
Fix:
Mark editor sessions that passed through Bubble Tea's process handoff,
and re-enable mouse cell tracking when those sessions complete
for sessions that started with mouse tracking enabled.
Editor setup failures retry without requesting mouse restoration,
and
--no-mousesessions do not gain mouse tracking after editor return.