[PR #4859] Synthesize VT mouse events and add mouse support to Terminal #26000

Open
opened 2026-01-31 09:13:12 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/4859

State: closed
Merged: Yes


Summary of the Pull Request

Make TerminalControl synthesize mouse events and Terminal send them to
the TerminalInput's MouseInput module.

The implementation here takes significant inspiration from how we handle
KeyEvents.

References

Closes #545 - VT Mouse Mode (Terminal)
References #376 - VT Mouse Mode (ConPty)

TerminalControl

  • _TrySendMouseEvent attempts to send a mouse event via TermInput.
    Similar to _TrySendKeyEvent
  • Use the above function to try and send the mouse event before
    deciding to modify the selection

TerminalApi

  • Hookup (re)setting the various modes to handle VT Input
  • Terminal is always in VT Input mode (important for #4856)

TerminalDispatch

  • Hookup (re)setting the various modes to handle VT Input

TerminalInput

  • Convert the mouse input position from viewport position to buffer
    position
  • Then send it over to the MouseInput in TerminalInput to actually do it
    (#4848)

Validation Steps Performed

Tests should still pass.

**Original Pull Request:** https://github.com/microsoft/terminal/pull/4859 **State:** closed **Merged:** Yes --- ## Summary of the Pull Request Make TerminalControl synthesize mouse events and Terminal send them to the TerminalInput's MouseInput module. The implementation here takes significant inspiration from how we handle KeyEvents. ## References Closes #545 - VT Mouse Mode (Terminal) References #376 - VT Mouse Mode (ConPty) ### TerminalControl - `_TrySendMouseEvent` attempts to send a mouse event via TermInput. Similar to `_TrySendKeyEvent` - Use the above function to try and send the mouse event _before_ deciding to modify the selection ### TerminalApi - Hookup (re)setting the various modes to handle VT Input - Terminal is _always_ in VT Input mode (important for #4856) ### TerminalDispatch - Hookup (re)setting the various modes to handle VT Input ### TerminalInput - Convert the mouse input position from viewport position to buffer position - Then send it over to the MouseInput in TerminalInput to actually do it (#4848) ## Validation Steps Performed Tests should still pass.
claunia added the pull-request label 2026-01-31 09:13:12 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#26000