Skip to content

Send the wheel to an agent that tracks the mouse as a wheel report - #21

Merged
tdwd merged 2 commits into
mainfrom
pane-wheel
Oct 9, 2026
Merged

tdwd merged 2 commits into
mainfrom
pane-wheel

Conversation

@tdwd

@tdwd tdwd commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Two commits, reviewable one at a time:

  1. Move the dashboard's mouse handling to dashmouse.go. A pure move, so mouse.go stays under 200 lines.
  2. Send the wheel to an agent that tracks the mouse as a wheel report. A wheel notch over the pane went to the agent as ↑ or ↓. cathode with mouse capture on reads ↑ as the previous prompt, so the wheel recalled history until /mouse turned capture off, in every session. The runner now follows the agent's mouse modes. An agent that set a tracking mode gets a wheel report (SGR with ?1006, X10 without) at the pane cell under the pointer. Any other agent still gets ↑ or ↓.

Runner.Wheel encodes the report itself rather than using the emulator's SendMouse. The commit message and docs/architecture.md say why.

Tests check the exact bytes the agent receives for each tracking mode, both encodings, the X10 range limit, a cleared mode and a full reset. They also check the pane cell under the pointer, the clamp on a short terminal, and that a click sends nothing.

tdwd added 2 commits October 9, 2026 12:39
mouse.go keeps the routing and the session view. dashboardMouse,
dashboardHit, click and wheel move unchanged, with their comments, so
the next change to the pane's wheel does not push mouse.go past 200
lines.
A wheel notch over the pane went to the agent as the ↑ or ↓ key. cathode
with mouse capture on, its default, reads ↑ as the previous prompt, so
the wheel recalled history instead of scrolling until /mouse turned
capture off, and that had to be done again in every session.

The runner now follows the agent's mouse modes through the emulator's
mode callbacks, a full reset included. An agent that set a tracking mode
gets a wheel report at the pane cell under the pointer, SGR if it set
?1006 and X10 if not. Any other agent still gets ↑ or ↓.

Runner.Wheel encodes the report and writes it to the PTY as a key is
written. The emulator's SendMouse writes to its reply pipe while holding
the emulator lock, so an agent that stopped reading its input could
freeze every render, and its X10 encoder writes a coordinate of 95 or
more as two UTF-8 bytes.

The notch is clamped to the pane rows on screen, and a terminal too
short to draw the pane sends nothing. sendToAgent becomes a wrapper
over toAgent, so the wheel reports a failed write the way a key does.
@tdwd
tdwd merged commit bccdb8f into main Oct 9, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant