tact icon indicating copy to clipboard operation
tact copied to clipboard

feat(tact): Add semantic copy actions for code blocks and messages

Open N0xMare opened this issue 4 months ago • 1 comments

Problem

Mouse selection currently copies rendered terminal cells when it could ideally copy raw code-block contents instead of rendered TUI borders so copying a fenced code block wont include decorative characters and padding:

╭─ text ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ │ command here │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

mouse user plebs must manually remove these. Terminal-specific rectangular-selection shortcuts are not discoverable or consistent.

Proposed solution

Add a clickable and keyboard-focusable Copy action to each rendered code-block header. It should copy the original parsed code-block contents—not the rendered terminal buffer.

For example:

╭─ text ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ ╭─ zsh ─────────────────────────────── [Copy] ╮ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

A message-level Copy action could additionally copy the assistant message as original Markdown or semantic plain text.

Tact can reuse its existing native clipboard and terminal clipboard fallback. Each rendered code block would retain its raw source plus a mouse hit region for the button.

Acceptance criteria

• Clicking Copy copies only the raw code. • Indentation and newlines are preserved. • Borders, padding, language fences, and visual wrapping are excluded. • The action works without editor knowledge or terminal-specific modifiers. • Success or failure is shown through the existing TUI notification system. • Mouse selection no longer includes purely decorative transcript chrome where practical.

N0xMare avatar Jul 29 '26 16:07 N0xMare

related: #29

clabby avatar Jul 29 '26 17:07 clabby