M32: copy mode in the TUI (scrollback, selection, OSC 52, search) #51

Closed
opened 2026-10-02 07:58:06 +00:00 by jhgaylor · 1 comment
Owner

Depends on: #50 (M31)

TUI track. Selecting and copying inside a pane. The outer terminal sees the whole composite, so it can't select one pane's text or scroll one pane's history; the TUI has to do it. S19 (#48) found this to be the largest piece left.


  • Scrollback: the wheel and Shift+PgUp/PgDn scroll the pane's local engine, which holds the history from its snapshot. Typing jumps back to the bottom; a dim marker shows how far up you are.
  • Selection: drag to select within one pane (libghostty selection; RowIteration::selection marks the cells), double-click a word, triple-click a line. A Shift-drag goes to the program's mouse reporting instead, as terminals do.
  • Copy: OSC 52 to the outer terminal's clipboard (works over ssh), plus the selection as plain text through capture's rules (no trailing blanks, joined soft wraps).
  • Keyboard copy mode: Ctrl-] [ enters it: hjkl or arrows, v to select, y to copy, / and ? to search the pane's history, q to leave.
  • Command marks: jump between prompts (OSC 133 marks the daemon already has) and select a whole command's output in one go.
  • Done when:
    • text selected in a pane over ssh geek pastes into the laptop's clipboard;
    • a search finds a line 30k rows up, and the view lands on it;
    • selecting a command's output by its mark copies exactly what illogical capture --last-command prints.
**Depends on:** #50 (M31) *TUI track. Selecting and copying inside a pane. The outer terminal sees the whole composite, so it can't select one pane's text or scroll one pane's history; the TUI has to do it. S19 (#48) found this to be the largest piece left.* -------- - **Scrollback:** the wheel and Shift+PgUp/PgDn scroll the pane's local engine, which holds the history from its snapshot. Typing jumps back to the bottom; a dim marker shows how far up you are. - **Selection:** drag to select within one pane (libghostty selection; `RowIteration::selection` marks the cells), double-click a word, triple-click a line. A Shift-drag goes to the program's mouse reporting instead, as terminals do. - **Copy:** OSC 52 to the outer terminal's clipboard (works over ssh), plus the selection as plain text through `capture`'s rules (no trailing blanks, joined soft wraps). - **Keyboard copy mode:** Ctrl-] [ enters it: hjkl or arrows, `v` to select, `y` to copy, `/` and `?` to search the pane's history, `q` to leave. - **Command marks:** jump between prompts (OSC 133 marks the daemon already has) and select a whole command's output in one go. - **Done when:** - text selected in a pane over `ssh geek` pastes into the laptop's clipboard; - a search finds a line 30k rows up, and the view lands on it; - selecting a command's output by its mark copies exactly what `illogical capture --last-command` prints.
Author
Owner

Done: merged as bc73941 (Merge M32), released in v0.5.0. PLAN.md: M32 section.

  • Drag selection, double- and triple-click, and Shift-drag when the program takes the mouse. Copying goes out by OSC 52, so it works over ssh.
  • Copy mode (Ctrl-] [): hjkl and page moves, v/V selection, y to copy, search with / ? n N, [ ] to jump between prompts, o to select a command's output by its OSC 133 marks.
  • Deep search: when the 10k in-memory rows miss, the search reads the pane's on-disk log (up to 32 MiB, through tail's new until=) into a separate archive terminal. The live terminal is never replaced.
    Tests: unit tests in vt and cli, api.rs tail until=, and web/e2e/tui-copy.spec.ts (copy into tmux's paste buffer, a needle 40k rows up, command output equal to capture --last-command). CI green (732, 733).
    Not covered: o copies what's shown, not the raw bytes; the archive replays at the current width. OSC 52 into real clipboards (iTerm2, a phone, ssh from the laptop) is on #55 Needs Jake.
Done: merged as bc73941 (Merge M32), released in v0.5.0. PLAN.md: M32 section. - Drag selection, double- and triple-click, and Shift-drag when the program takes the mouse. Copying goes out by OSC 52, so it works over ssh. - Copy mode (Ctrl-] [): hjkl and page moves, v/V selection, y to copy, search with / ? n N, [ ] to jump between prompts, o to select a command's output by its OSC 133 marks. - Deep search: when the 10k in-memory rows miss, the search reads the pane's on-disk log (up to 32 MiB, through tail's new until=) into a separate archive terminal. The live terminal is never replaced. Tests: unit tests in vt and cli, api.rs tail until=, and web/e2e/tui-copy.spec.ts (copy into tmux's paste buffer, a needle 40k rows up, command output equal to capture --last-command). CI green (732, 733). Not covered: o copies what's shown, not the raw bytes; the archive replays at the current width. OSC 52 into real clipboards (iTerm2, a phone, ssh from the laptop) is on #55 Needs Jake.
Commenting is not possible because the repository is archived.
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jhgaylor/illogical#51
No description provided.