Skip to content

feat(zerocode): make terminal copy/paste work the way users expect#7

Open
JordanTheJet wants to merge 2 commits into
masterfrom
zerocode-copy-paste-qol
Open

feat(zerocode): make terminal copy/paste work the way users expect#7
JordanTheJet wants to merge 2 commits into
masterfrom
zerocode-copy-paste-qol

Conversation

@JordanTheJet

Copy link
Copy Markdown
Owner

Summary

  • Base branch: master
  • What changed and why: In the zerocode TUI, mouse capture is enabled by default, which hijacks the terminal's own click-drag selection — so users could not select/copy text with the mouse — and Ctrl+V tried the clipboard image before text, adding a per-paste subprocess and surprising behavior on the common text path.
  • Add a global selection mode toggle (Ctrl+O) that turns terminal mouse capture off/on at runtime. With it off, the terminal handles native drag-select, copy, and paste; a status-bar banner shows the mode and the exit key (read from the resolved keymap so a rebind stays accurate), and falls back to a compact form that leads with the exit key when the connection status crowds the column.
  • Make Ctrl+V paste text-first, falling back to image attachment only when the clipboard holds no text — skipping the image-tool subprocess on the common path and complementing bracketed paste.
  • Surface both affordances in the help modal: the selection-mode key and the Shift+drag native-selection hint most terminals support.
  • Scope boundary: Does NOT change the OSC-52 copy path (y / Ctrl+Shift+C), bracketed-paste handling, or the startup mouse-capture default. No agent-switching changes (separate PR).
  • Blast radius: Confined to apps/zerocode (TUI client): app event loop (app.rs), a new config_manager::set_mouse_capture terminal helper, the input-bar paste path, and one new GlobalAction. The toggle is loop-local state; capture state persists correctly across reconnect and is unconditionally disabled on exit by restore_terminal.
  • Linked issue(s): None — addresses a direct user QOL request ("can't copy and paste easily").
  • Labels: expect auto path/scope labels for apps/zerocode; suggest enhancement, size: S, risk: medium (touches apps/zerocode/src/**).

Validation Evidence (required)

cargo fmt --all -- --check
cargo clippy --all-targets -- -D warnings
cargo test
  • Commands run and tail output:
    • cargo fmt --all -- --check → clean, no diff (exit 0).
    • cargo clippy --all-targets -- -D warningsFinished with no warnings (exit 0).
    • cargo test → 0 failures across the workspace (grep -c "test result: FAILED"0). The zerocode package: test result: ok. 348 passed; 0 failed; 0 ignored and ok. 111 passed; 0 failed.
  • Beyond CI — what did you manually verify? Traced the toggle through the event loop: Ctrl+O is a free global chord (no pane/input-bar binding), handled before pane dispatch and not gated on text-input, so it works from any pane and never reaches a pane handler. Confirmed the banner reads resolved_bindings() (rebind-accurate, matching the help modal) and compacts when left_area.width is below the full banner width. Verified text-first paste falls through to image attach when read_clipboard_text() returns None/empty (its documented contract), preserving the pure-screenshot workflow. NOT verified: behavior on every terminal emulator's Shift-drag override, and the both-flavors (text + image) clipboard case (documented tradeoff — text wins; attach images via /attach or Ctrl+A).
  • If any command was intentionally skipped, why: None skipped.

Security & Privacy Impact (required)

  • New permissions, capabilities, or file system access scope? No
  • New external network calls? No
  • Secrets / tokens / credentials handling changed? No
  • PII, real identities, or personal data in diff, tests, fixtures, or docs? No
  • If any Yes, describe the risk and mitigation: N/A. (Paste reads the local clipboard via the same already-present platform tools; no new capability.)

Compatibility (required)

  • Backward compatible? Yes
  • Config / env / CLI surface changed? Yes — adds a new rebindable keymap action global.toggle_mouse_capture (default Ctrl+O) and new info-bar/help strings. No migration; existing configs and keybinding overrides are unaffected, and Ctrl+O was previously unbound.
  • If No or Yes to either: exact upgrade steps for existing users: None — additive and active by default. Note one intentional behavior change: Ctrl+V now prefers clipboard text over a clipboard image.

Rollback (required for risk: medium and risk: high)

Low blast radius (single TUI binary). git revert <sha> cleanly removes the toggle, the banner, the set_mouse_capture helper, and the text-first paste change; mouse capture reverts to always-on and Ctrl+V to image-first.

* ci(clawpatch): review every PR with zeroclaw as the brain

Adds a GitHub Actions workflow that, on each PR, installs the prebuilt zeroclaw
binary + acpx, points acpx at `zeroclaw acp` (stdio ACP), and runs `clawpatch ci`
with provider=acpx so changed code is reviewed by ZeroClaw's own coding agent
(Claude-backed). Non-blocking; findings post to the job summary + an artifact.
Requires the ANTHROPIC_OAUTH_TOKEN repo secret.

* ci: daily auto-sync fork master with upstream zeroclaw-labs/zeroclaw
Mouse capture is enabled by default, which hijacks the terminal's own
click-drag selection — so users could not select/copy text with the mouse,
and Ctrl+V tried the clipboard *image* before text, adding latency and
surprise on the common text path.

- Add a global "selection mode" toggle (Ctrl+O) that turns terminal mouse
  capture off and on at runtime. With it off, the terminal handles native
  drag-select, copy, and paste; a status-bar banner shows the mode and the
  exit key, read from the resolved keymap so a rebind stays accurate. The
  banner falls back to a compact form (leading with the exit key) when the
  connection status crowds the column, so the exit hint is never clipped.
- Make Ctrl+V paste text-first, falling back to image attachment only when
  the clipboard holds no text. This also skips the per-paste image-tool
  subprocess on the common path, and complements bracketed paste. When a
  clipboard carries both text and an image the text wins; attach such an
  image via /attach or the Ctrl+A file browser.
- Surface both affordances in the help modal: the selection-mode key and the
  Shift+drag native-selection hint most terminals support.
@JordanTheJet JordanTheJet added the enhancement New feature or request label Jun 19, 2026
singlerider pushed a commit that referenced this pull request Jun 23, 2026
…roclaw-labs#7688) (zeroclaw-labs#8041)

- 20400f8 test(runtime): pin hook panic recovery + cancellation propagation (#7…
- 761bf86 ci: re-trigger Quality Gate on zeroclaw-labs#8041
- 18853a9 Merge branch 'master' into fix/issue-7688-hook-panic-recovery
singlerider added a commit that referenced this pull request Jun 27, 2026
…uzzySelect

The bug-1 fix (FuzzySelect rewinds the cursor past its painted block and erases
scrollback above the menu, worst on double-width CJK) was applied to
run_onboard_tree/CliSurface but NOT to run_quickstart_cli, the handler behind
`zeroclaw quickstart` — the very command the onboard deprecation notice steers
users toward. That path was a separate hand-rolled flow still calling raw
FuzzySelect::new() on all 12 menu pickers, with no theme and a raw Password for
secret entry, so the cursor-erase (#1), missing styling (#7), and secret-repaint
(#8) defects shipped live there while the driver guard only exercised the fixed
onboard tree.

Extract the theme and a themed Select helper (onboard_select /
onboard_select_default) to module scope, reuse them from CliSurface (removing the
duplicate inline theme/select), and convert every run_quickstart_cli picker plus
the shared prompt_for_field enum picker and pick_preset to onboard_select. Each
row is fit to one terminal line via fit_select_item so the 1-row-per-item clear
arithmetic holds at any width and locale. Secret entry already routed through the
in-place masked_secret. No FuzzySelect remains in the onboard/quickstart flow;
the only one left is the config-set model-id catalog picker, where fuzzy filter
over a long model list is intentional.

Bin builds with onboard; fmt + clippy clean; onboard suite 47 green.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant