#2
Mouse clicks do not reach terminal programs that enable mouse reporting
Summary
Clicking inside a terminal pane does not reach programs that use the mouse. TUIs and full-screen apps that enable mouse reporting (htop/btop, lazygit, opencode's UI, vim/neovim with mouse=a, etc.) do not react to clicks, drags or wheel events; the click appears to be taken by the client instead.
Expected: a click inside a pane is delivered to the program as a mouse report when it has enabled one of the mouse modes (1000/1002/1003, or 1006/SGR for coordinates), exactly as it is in Rex and in other Ghostty-based terminals.
Actual: the program never sees the press. Clicking still focuses the pane, so the client is receiving the event.
Suspects in this client
internal/ui/workspace.goattachesOnClickto the terminal element (tv.OnClick(...)callingfocusPane) and to the pane card. That may consume the pointer press, or make the element's own input handling see it first.- The pane card also handles clicks for focus and the workspace may rebuild on the press, so the release can land on a different element than the press.
focusPanecallssession.focus_blockon every click; worth checking whether that refresh interrupts the terminal's mouse state.- Mouse coordinates are in window space; worth checking they reach the plugin in the terminal's own coordinate space given the panes are absolutely positioned inside a clipped card.
To reproduce
- Run a TUI that takes the mouse, e.g.
btoporlazygit, in a pane. - Click a row or a button on screen.
- Observe: nothing happens in the program; the pane only takes focus.
Environment
- rexnux
5e14ed4 - MyGo v0.7.4, terminal plugin (libghostty-vt)
- Linux/Wayland, Hyprland
- Rex server 0.1.0-preview.12, API revision 8
Follow-up from #6 (drag-and-drop tiling).
With pane headers hidden, each pane now has a 12 px invisible strip along its top edge that starts a pane drag. Today that strip takes pointer events before the terminal sees them, which is harmless while mouse reporting is broken, but once this issue is fixed it must not swallow mouse reports or text selection in that band.
When fixing #2, please make the strip coexist with the terminal: for example, only claim the press once the pointer actually moves into a drag (so a click still reaches the program), or shrink/disable the strip while a terminal has mouse reporting enabled. The same precedence check should apply to the pane card's focus click.