Skip to content

Copy: selections, picker, sticky Copy; Smart Folding folds long output - #358

Draft
raiseCatError wants to merge 32 commits into
feature/command-queuefrom
feature/copy-selection
Draft

raiseCatError wants to merge 32 commits into
feature/command-queuefrom
feature/copy-selection

Conversation

@raiseCatError

@raiseCatError raiseCatError commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner

Copy selection and block controls operate on stored command/output records and produce plain text without NMSh presentation chrome. The picker, sticky actions and folding preserve selection and FOLLOW/DETACHED behavior. Copying folded output uses the stored text without automatically expanding the block or changing raw PTY output.

The additive stabilization fixes catchable startup termination and frontend cleanup. SIGTERM/SIGHUP handlers precede host-probe/journal waits; stopped probe completion cannot create a journal, and saves already underway retain durability. Stop removes only the frontend's instance-owned exit callback, preventing retention across session switches while preserving unrelated listeners. Controlled regressions fail before correction and pass afterward; assertions and deadlines are unchanged.

The reattach fixture waits for the complete final-size native pager frame and prompt before a single quit key, retaining original deadlines and strict cleanup. Bounded failure-only observations distinguish repaint from quit completion. Controlled native less read/WINCH evidence establishes a signal/input hazard; it does not reconstruct historical CI failures.

Native completion retains fragmented readiness within a bounded initialization buffer and recognizes the complete LF/CRLF marker without resetting existing budgets. A real-PTY regression fails before correction and passes afterward, including naturally fragmented reads. This independently confirmed framing fix does not establish the historical Copy recovery failure cause.

Clipboard completion requires an error-free payload-write callback and the backend’s own successful exit, retaining original error/timeout/process cleanup safeguards. Real-child regressions cover suppressed finish, partial reads and callback errors after exit. Early fullscreen startup regressions submit before the notice through the actual editor/submit pipeline, including delayed journal startup; original input/abort/ownership assertions remain intact. This proves independently controlled defects/fixture assumptions, not the precise historical failure causes.

Published head: 839d23f3bfb780c164b3fa19137170944abe0d21. Focused lifecycle/startup/clipboard, clean exact-head canonical build/full runtime/ranking/cleanup/diff verification pass. Comprehensive candidate CI 38565279297 passes every required job, including Fedora/timing; actual PR CI 38566317316 passes applicable platform/runtime/aggregate gates. Attempts: 1/1.

Shared acceptance, exact ancestry, remaining gates and retained historical failures are tracked in #359 and the durable handoff. Historical macOS/Ubuntu failures remain unattributed; new passes do not explain them. Native pager input during concurrent resize remains a physical QA limitation. Forced SIGKILL can bypass detached-helper cleanup while trusted configuration blocks it. No release/master merge or frontend integration occurs here.

Physical QA remains unperformed in Ghostty/Terminal.app across zsh, Bash and Fish: selection/picker/sticky actions, folded copying and FOLLOW/DETACHED navigation at narrow and short sizes. Automated/headless results do not claim this validation.

Refs #350
Refs #359

…y Copy; Smart folds long output

/copy and its alias /cp:
- /copy N, /copy -N (latest N), /copy A-B, /copy 1,3-5, /copy latest, /copy ui; outputs join oldest
  first, overlaps once. A missing number refuses the whole copy; nothing is half-copied.
- --status / --no-status override "Include completion status" (Off by default) for one copy: each
  output is followed by the status NMSh recorded for it (outcome, exit code, time, waits). Stored
  output is never changed; a silent command copies its status alone only when status is asked for.
- Settings → Copy (also /copy settings): Quick Copy or Interactive Picker for a bare /copy, Include
  completion status, Auto-expand copied output. Persisted and part of settings export/import.
- Interactive Picker: newest first with /copy numbers, Space/a to select, / to search, preview of the
  highlighted output, s to toggle statuses (shown before Enter), Enter copies oldest first.
- Feedback is a brief note above the composer after the clipboard accepted the text, never a
  transcript line; mistakes in a typed /copy still answer in the transcript.

Blocks:
- A direct [Copy] beside [Actions] where the row has room; it reads "✓ Copied" in place (same
  width, Actions never moves). Copy output and Copy command + output follow the status setting;
  Copy command never does.
- While a completed block's header is scrolled away, its Copy and Actions ride on the sticky header
  row, owned by the block's startId; one set of controls on screen at a time. NMSh's viewport only:
  native terminal scrollback is not something NMSh can decorate. Captures: docs/captures/sticky-*.

Folding and copying are independent: no copy path changes what is folded. With "Auto-expand
copied output" On, only the blocks whose text was copied unfold, after a successful write.

Smart Folding: long output (120+ lines, or as many rows when long lines wrap at 120 columns) now
folds whatever the command or exit status. Before, varied diagnostics (adb getprop, ps, env) and
any output containing a single "error" word never folded. Up to three important lines from the
hidden middle (errors, compiler locations, the first frame of a trace) stay in view, and the
summary counts them. A block is never collapsed at completion while you are scrolled back or
selecting. Shorter output keeps the existing content heuristics.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant