Troupe owns the mouse selection: click-drag inside the activated pane highlights text, release copies it, and Ctrl-Y copies the selection when there is one and the whole transcript when there is not¶
TUI decision 82 · accepted · 2026-09-16
Decision 68 accepted that mouse reporting takes the terminal's own click-and-drag away and offered --no-mouse as the only way back, which costs the wheel and tile clicks; the complaint that followed was the other half — Ctrl-Y copies everything, and there was no way to lift one command, one line or one diff hunk out of a transcript. A runtime mouse toggle would be the obvious fix and is not implementable here: ExRatatui 0.13.1 executes EnableMouseCapture/DisableMouseCapture only inside init_terminal/restore_terminal and exposes no set_mouse_capture/2 and no raw-escape passthrough, so nothing in Elixir can hand selection back for one drag (it is a ~20-line upstream PR, and a /mouse on|off command would need it too — which is why the setting's effect is still :next_run). Doing the selection inside Troupe costs nothing extra, because crossterm's EnableMouseCapture already turns on 1002 and 1003, so drag and moved events were arriving and being dropped. The anchors are transcript coordinates — {visual_row, cell_col}, the row absolute in the concatenated wrapped blocks — not screen ones, so new output and scrolling leave a selection on the text the user picked, and dragging past the top or bottom row scrolls (scroll_by/2) so a selection can cross a screen boundary; a reflow moves every wrapped row, so %Resize{} clears it rather than highlighting the wrong cells. It lives in TUI.Server state next to pane, never as a fold over the log: it is a cursor, so a TUI restart must come back with nothing selected. What is copied is the wrapped text with rails, gutters and line numbers dropped (Model.row_slice/3), which is the honest answer for a selection — the opposite of whole-transcript copy, which deliberately un-wraps to recover the agent's own line breaks. Splitting a row is Model's job and re-tagging it is View's (%Style{modifiers: [:reversed]} on each segment's own resolved style, so syntax highlighting survives and no theme decision is needed), which keeps styling in one module. A press with no drag still means "follow the tail", so the new down clause falls through to the tile hit-test whenever View.pane_point/3 says the cell is outside the transcript's interior, and Esc is two-stage: it clears a selection before it leaves the window, so a mis-drag does not cost the pane. --no-mouse stays as the escape hatch for the emulator's selection (rectangular blocks, selecting from the tiles or the observer), and the modifier bypass most emulators offer is now in the README next to it.
Governs: clients/tui/lib/troupe/ui/tui/server.ex