Skip to content

Mouse tracking is not restored after source editor exits #275

Closed

Description

@phewitt

When opening a source file with e and returning from the editor, mouse-wheel input can behave incorrectly because Bubble Tea v1 does not restore mouse tracking after tea.ExecProcess.

There seem to be two possible fixes:

  1. Fix it upstream in Bubble Tea. This was previously proposed in fix: restore mouse state after ExecProcess charmbracelet/bubbletea#1583, but the PR was closed after Bubble Tea’s renderer architecture changed.
  2. Add a small revdiff-local workaround: mirror the existing annotation-editor behavior and return tea.EnableMouseCellMotion after the source editor exits, while preserving reload behavior and respecting --no-mouse.

I have the second approach implemented and tested locally. If that approach is acceptable, I’d be happy to follow up with a PR.

Really liking revdiff btw. TY

Activity

  1. umputun commented on Jul 17, 2026

    @umputun
    Owner

    confirmed, your diagnosis is exactly right. Two editor paths and only one restores mouse tracking after the tea.ExecProcess handoff:

    • annotation editor (ctrl+e) restores it, fixed in fix(ui): Restore mouse after editor return #235 where handleEditorFinished emits tea.EnableMouseCellMotion
    • source editor (e) does not, sourceEditorFinishedMsg / handleSourceEditorFinished in app/ui/editor.go never re-emit the enable sequence

    #235 only touched the annotation path, so e was left with the same defect it fixed.

    approach 2 is the way to go: mirror the annotation path and gate on the mouseTracking flag so --no-mouse still wins. PR welcome, pls keep it minimal and matching the existing pattern, and restore on both the clean and error return since the terminal is released either way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions