-
-
Notifications
You must be signed in to change notification settings - Fork 0
Mouse Support
M31 Autonomous (M31A) provides full mouse interaction across all viewport-based screens.
Source: internal/tui/repl_mouse.go
Mouse support is enabled via tea.MouseAll in the program options. The REPL model dispatches mouse events to the appropriate handler based on coordinates and UI state.
Scroll wheel events are forwarded to the active viewport. Supported on:
- REPL viewport
- Plan model viewport
- Execute model viewport
- Verify model viewport
- Ship model viewport
- Ledger model viewport
- Chat history viewport
Left-click events are routed based on the click coordinates:
| Target | Action |
|---|---|
| Viewport area | Focus textarea + mark user-scrolled |
| Slash-suggestion overlay | Select the suggestion item |
| Mention-suggestion overlay | Complete the mention |
| Scrollbar thumb | Begin drag-scrolling |
Click and drag on the scrollbar thumb to scroll the viewport proportionally. The drag state is tracked via scrollbarDragging in the REPL model.
The mouse event dispatcher is implemented in repl_mouse.go:
handleMouseMsg(msg)
├── MouseActionPress
│ ├── WheelUp/Down/Left/Right → handleWheel()
│ └── MouseButtonLeft → handleLeftClick()
├── MouseActionRelease
│ └── MouseButtonLeft → stop drag
└── MouseActionMotion
└── handleScrollbarDrag()
| Function | Purpose |
|---|---|
handleMouseMsg() |
Main dispatcher for all mouse events |
handleWheel() |
Scroll wheel events forwarded to viewport |
handleLeftClick() |
Routes clicks to overlays, scrollbar, or viewport |
handleScrollbarDrag() |
Drag-scrolling via scrollbar thumb |
handleViewportClick() |
Tool card click detection in viewport |
Mouse events are handled in the Update loop alongside keyboard events. No additional keybindings are required -- mouse interaction is always active when the terminal supports it.
Mouse support requires a terminal that sends mouse escape sequences. Most modern terminals support this:
- iTerm2 (macOS)
- Terminal.app (macOS)
- GNOME Terminal (Linux)
- Alacritty
- Kitty
- Windows Terminal
- WezTerm
| File | Purpose |
|---|---|
internal/tui/repl_mouse.go |
Mouse event dispatcher (301 lines) |
internal/tui/repl_model.go |
Mouse state fields (scrollbarDragging, userScrolled) |
internal/tui/repl.go |
Mouse event forwarding to handler |
internal/tui/app_update.go |
Mouse event routing to sidebar and sub-models |
internal/tui/sidebar_model.go |
Sidebar HandleMouse() method |