Skip to content

feat(tui): collapse large pastes to a marker, expandable in place - #236

Merged
Max17190 merged 4 commits into
tui-tool-cards-expand-failuresfrom
tui-paste-collapse-expand
Aug 27, 2026
Merged

feat(tui): collapse large pastes to a marker, expandable in place#236
Max17190 merged 4 commits into
tui-tool-cards-expand-failuresfrom
tui-paste-collapse-expand

Conversation

@Max17190

@Max17190 Max17190 commented Aug 27, 2026

Copy link
Copy Markdown
Owner

Why

A pasted log or minified blob splices verbatim into the draft, burying it and leaving the six-row composer scrolling through content the user never meant to edit. Comparable frontends that shipped collapse without a way back generated the field's angriest issue threads, so collapse and expand ship together.

Summary

A paste at ten lines or a thousand characters collapses to a numbered [pasted #N: ...] marker. The bytes rejoin the draft for every whole-text reader (submit, queueing, history), so a marker never leaves the composer. ctrl+o with the cursor on a marker splices the bytes back in place for editing, outranking the last-tool-block expansion only in that position; an edited marker stops matching and stays literal. Small pastes splice exactly as before.

Test Plan

  • large_paste_collapses_to_a_marker_and_reads_back_expanded, small_pastes_splice_literally, a_single_line_blob_collapses_on_the_char_bound, expand_paste_at_cursor_splices_the_bytes_back_for_editing (incl. cursor-off-marker refusal and idempotence), an_edited_marker_never_expands.
  • Collapse and expansion each shown red with their mechanism neutered; existing paste-splice and CRLF tests unaffected. Workspace tests and clippy clean.

Greptile Summary

This update collapses large terminal pastes into editable markers while preserving their original content for submission, adds cursor-targeted marker expansion, improves approved-file recovery commands, and refines terminal replay, notification, and unread-message behavior. Focused composer checks confirmed that duplicate marker text does not deliver hidden content twice and that marker-like text embedded in an earlier paste does not interfere with a later paste. Ledger output also retained the correct approved object-to-file mappings after bound files changed.

Confidence Score: 5/5

No blocking failure remains; the exercised composer and ledger recovery flows behaved as intended.

No accepted blocking findings remain.

T-Rex T-Rex Logs

What T-Rex did

  • I built and ran the OpenMax CLI against the approved external-tool manifest binding (runner.sh and helper.py) and captured the ledger output before and after rewriting both live files; the results show each stored object is paired with its original bound path and the restore targets remain derived from the authenticated approval data.
  • I reproduced the baseline sequential marker-replacement behavior and ran the focused Rust composer regression tests; the tests completed successfully, and the current composer delivers hidden content once for a typed duplicate marker and restores a later paste at its real marker while leaving embedded marker-like text literal.
  • I validated multi-file tool restore consistency by comparing multi-file logs; the before log shows the initial approved ledger footer with two bound-file restore commands and the after log shows mappings after changes, proving paths come from the approved manifest rather than live content.
  • I ran the baseline legacy sequential replacement, observed the former failures, and confirmed the current focused Rust tests pass; the harness source and command outputs are uploaded for review.

View all artifacts

T-Rex Ran code and verified through T-Rex

Reviews (4): Last reviewed commit: "fix(tui): paste expansion never searches..." | Re-trigger Greptile

@Max17190
Max17190 marked this pull request as ready for review August 27, 2026 03:53
@Max17190
Max17190 force-pushed the tui-paste-collapse-expand branch from 91fb3ee to 0f50ea6 Compare August 27, 2026 03:55
Comment thread crates/tui/src/input.rs Outdated
@Max17190
Max17190 force-pushed the tui-paste-collapse-expand branch from 0f50ea6 to d954dbc Compare August 27, 2026 04:58
Comment thread crates/tui/src/input.rs Outdated
A pasted log or blob spliced verbatim into the draft, burying it and
leaving the six-row composer scrolling through content the user never
meant to edit. A paste at ten lines or a thousand characters now
collapses to a numbered [pasted #N: ...] marker; the bytes rejoin the
draft for every whole-text reader (submit, queueing, history), so a
marker never leaves the composer, and ctrl+o with the cursor on a
marker splices the bytes back in place for editing. Collapse and
expand ship together deliberately: a collapsed paste with no way back
is worse than no collapse. An edited marker stops matching and simply
stays literal.
expand_pastes replaced every occurrence of a marker, so hand-typing a
marker's exact spelling injected the hidden paste twice on read or
submit. Each insertion wrote its marker exactly once, so exactly one
occurrence expands.
…eference

The gesture anchored on the row's first occurrence of a marker, so a
byte-identical duplicate typed earlier both swallowed the gesture aimed
at the genuine marker and could receive the splice while the genuine
marker stayed expandable, delivering the hidden bytes twice. The match
is now cursor-anchored, and an in-place expansion tombstones the store
slot, so a surviving duplicate is literal text on every later path.
@Max17190
Max17190 force-pushed the tui-paste-collapse-expand branch from d954dbc to f2a3626 Compare August 27, 2026 05:19
Comment thread crates/tui/src/input.rs
Sequential replacement rescanned the progressively expanded string, so
a marker spelling embedded in an earlier paste's content captured a
later paste's expansion and the genuine marker submitted as literal
text. Every live marker is now located in the draft text first and
spliced in one pass; expanded bytes are content, never search
territory.
@Max17190
Max17190 merged commit 90e831f into main Aug 27, 2026
4 checks passed
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