TUI: mouse drag selection with OSC 52 copy; Markdown emphasis follows CommonMark; v0.5.0
ci / linux (clang) (push) Failing after 21m53s
ci / linux (gcc) (push) Failing after 48s
ci / musl (push) Canceled after 0s
ci / macos (push) Canceled after 0s
ci / sanitizers (push) Canceled after 11m39s

- Drag, double-click (word) and triple-click (line) selection in the log,
  auto-scroll at the edges, soft-wrapped lines joined on copy.
- sashidown ANSI renderer: delimiter runs with flanking rules, so
  intraword underscores (test_apply_patch.c) stay literal; unmatched
  * _ and backticks are shown as-is; * and _ do not close each other.
- tests: test_textsel, test_markdown.
This commit is contained in:
WHC
2026-10-06 14:24:42 +08:00
parent b28bca2cfc
commit 1c26cc6e30
11 changed files with 875 additions and 111 deletions
+12 -3
View File
@@ -81,9 +81,15 @@ take the agent down.
- UTF-8 locale gives the full UI. Under a non-UTF-8 locale, or with
`CST_ASCII=1`, box and icon glyphs fall back to ASCII.
- `NO_COLOR=1` turns colours off.
- `/copy` uses OSC 52. iTerm2 needs "Applications in terminal may access
clipboard"; tmux needs `set -g set-clipboard on`; Windows Terminal (WSL)
supports it out of the box.
- `/copy` and mouse selection use OSC 52. iTerm2 needs "Applications in
terminal may access clipboard"; tmux needs `set -g set-clipboard on`;
Windows Terminal (WSL), kitty, WezTerm, foot and WHC Shell support it out of
the box.
- Mouse selection: the TUI turns on button-motion reporting (`?1002h`) on top
of what ncurses enables, so dragging over the transcript selects text
(double-click a word, triple-click a line) and releasing copies it. Terminals
without 1002 still get clicks and the wheel. Shift+drag bypasses the TUI and
uses the terminal's own selection.
- Bracketed paste needs ncurses (all platforms above).
- macOS Terminal.app sends Option+Enter as Esc+Enter only with "Use Option as
Meta key"; Ctrl+N always inserts a newline.
@@ -128,6 +134,9 @@ TUI:
- [ ] `/diff`, `/export`, `/status`, `/tools off grep`, `/yolo` work
- [ ] Mouse: click a tool card to expand it, click in the input to move the
cursor, click a picker row; `/mouse` turns it off
- [ ] Drag over a wrapped reply: it highlights, the status row says "Copied",
and pasting gives the paragraph without extra line breaks; double-click
copies a word
- [ ] Tab toggles Build/Plan, Shift+Tab cycles ask/auto/yolo, Ctrl+P opens the palette
- [ ] `/model` lists the provider's `/models` (marked `(api)`); a wrong key is re-asked
- [ ] `auto` mode: `echo x > ~/outside` in run_shell asks "Rerun outside the