Skip to content

feat(tui): /export writes the transcript to a file, p quotes a block into the prompt - #237

Merged
Max17190 merged 2 commits into
tui-paste-collapse-expandfrom
tui-transcript-escape-hatches
Aug 27, 2026
Merged

feat(tui): /export writes the transcript to a file, p quotes a block into the prompt#237
Max17190 merged 2 commits into
tui-paste-collapse-expandfrom
tui-transcript-escape-hatches

Conversation

@Max17190

@Max17190 Max17190 commented Aug 27, 2026

Copy link
Copy Markdown
Owner

Why

The transcript lives only on screen: folded cards, an 80-line raw cap, and one-block clipboard copy are the only ways out. A file-shaped escape hatch and a quote-into-prompt gesture are cheap and repeatedly asked for in comparable tools.

Summary

/export [path] writes the whole conversation as readable markdown, with every tool's full uncapped output as indented code (indentation, not a fence, so output containing backticks cannot break the document); fold state never changes the file. In scrollback, p drops the selected block's source into the composer for quoting output back at the model without a clipboard round-trip.

Test Plan

  • export_covers_the_full_output_regardless_of_fold_and_screen_caps (incl. past-the-cap line and fold invariance).
  • slash_export_writes_the_transcript_file, p_in_scrollback_quotes_the_block_into_the_prompt.
  • All shown red with the respective mechanism neutered. Workspace tests and clippy clean.

Greptile Summary

This change adds Markdown transcript export, scrollback-to-composer quoting, and collapsed handling for large pasted drafts. The earlier quote-suffix issue is resolved: the keyboard path now keeps hello world intact and appends quoted text on a new line. One blocking composer failure remains: editing a visible collapsed-paste marker can silently omit the original pasted content when the message is sent.

Confidence Score: 4/5

The change is not safe to merge until collapsed paste markers no longer allow ordinary edits to silently discard the hidden pasted payload.

One verified non-security blocking failure remains in the draft composer.

Files Needing Attention: crates/tui/src/input.rs

T-Rex T-Rex Logs

What T-Rex did

  • T-Rex produced proof for a posted P1 finding and linked it to the corresponding review comment.
  • T-Rex produced a second proof for a posted P1 finding.
  • The focused paste-marker submission harness source was provided as part of the proof evidence.
  • Observed output with intact paste marker demonstrates the initial submission behavior captured in the proof.
  • General-contract-validation-proof confirms marker validity logic and payload handling, including that changing the marker results in payload_present=false.

View all artifacts

T-Rex Ran code and verified through T-Rex

Comments Outside Diff (2)

  1. crates/tui/src/input.rs, line 288-289 (link)

    P1 Edited paste markers discard payloads

    Large pastes keep their contents outside the visible draft and restore them only when this exact marker string is still present. Editing a single character of [pasted #N: …] makes the lookup fail, so pressing Enter submits the altered marker while silently omitting the entire pasted payload. Preserve marker identity independently from its rendered text, expand the paste before allowing marker-internal edits, or prevent those edits with a clear warning.

    Artifacts

    Focused paste-marker submission harness source

    • Exact authored test source appended only to a disposable `/tmp` workspace copy; it compares intact submission with one-character marker editing. Takeaway: the repro uses the public composer input and Enter submission path.

    Observed output with intact paste marker

    • Captured output of the focused intact-marker test run, including the command, disposable working directory, exit code, and observation `submitted_lines=12`. Takeaway: an unmodified marker correctly restores and submits the hidden payload.

    Observed output after editing one marker character

    • Captured output of the focused edited-marker test run, including the command, disposable working directory, exit code, and observation `submitted="[asted Rust TUI harness with docs and MIT license #1: 12 lines]"; payload_present=false`. Takeaway: one ordinary visible-marker edit silently omits the entire hidden paste.

    View artifacts

    T-Rex Ran code and verified through T-Rex

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: crates/tui/src/input.rs
    Line: 288-289
    
    Comment:
    **Edited paste markers discard payloads**
    
    Large pastes keep their contents outside the visible draft and restore them only when this exact marker string is still present. Editing a single character of `[pasted #N: …]` makes the lookup fail, so pressing Enter submits the altered marker while silently omitting the entire pasted payload. Preserve marker identity independently from its rendered text, expand the paste before allowing marker-internal edits, or prevent those edits with a clear warning.
    
    ---
    
    For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
  2. General comment

    P1 Editing a collapsed-paste marker silently drops the hidden paste on submission

    • Bug
      • A large paste is represented by visible text such as [pasted #1: 12 lines], while its bytes are stored separately. A normal one-character edit to that visible marker prevents exact matching, so Enter submits only the edited marker and omits all hidden pasted content without warning or recovery.
    • Cause
      • expand_pastes() reconstructs payloads by exact marker-string lookup (text.find(&marker)). Any marker-internal edit makes the lookup fail. handle_key(Enter) then submits self.text(), which contains the edited marker but no stored payload. The code documents this as intended at input.rs:121-126, and the existing an_edited_marker_never_expands test asserts it at lines 1310-1320.
    • Fix
      • Preserve marker identity independently of its displayed characters, or expand the payload before permitting edits within a marker. At minimum, block marker-internal edits or require explicit expansion with a clear warning that deletion discards the hidden paste.

    T-Rex Ran code and verified through T-Rex

Prompt To Fix All With AI
### Issue 1
crates/tui/src/input.rs:288-289
**Edited paste markers discard payloads**

Large pastes keep their contents outside the visible draft and restore them only when this exact marker string is still present. Editing a single character of `[pasted #N: …]` makes the lookup fail, so pressing Enter submits the altered marker while silently omitting the entire pasted payload. Preserve marker identity independently from its rendered text, expand the paste before allowing marker-internal edits, or prevent those edits with a clear warning.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (4): Last reviewed commit: "fix(tui): the p quote lands at the end o..." | Re-trigger Greptile

@Max17190
Max17190 marked this pull request as ready for review August 27, 2026 03:53
@Max17190
Max17190 force-pushed the tui-transcript-escape-hatches branch from 0f21955 to 95be57f Compare August 27, 2026 03:55
Comment thread crates/tui/src/app.rs Outdated
@Max17190
Max17190 force-pushed the tui-transcript-escape-hatches branch 2 times, most recently from b0b81cf to dfe1ac9 Compare August 27, 2026 05:19
…into the prompt

The transcript lived only on screen: folded tool cards, an 80-line raw
cap, and clipboard copy of one block at a time were the only ways out.
/export [path] writes the whole conversation as readable markdown with
every tool's full uncapped output as indented code (indentation, not a
fence, so output containing backticks cannot break the document), and
fold state never changes the file. In scrollback, p drops the selected
block's source into the composer for quoting output back at the model
without a clipboard round-trip.
Inserting at the composer cursor spliced the draft's suffix onto the
quoted block (hello| world became hello, then quoted world on one line).
Composer::append_block moves to the end and goes through the normal
splice path, because rebuilding via text() would expand collapsed paste
markers on the way.
@Max17190
Max17190 force-pushed the tui-transcript-escape-hatches branch from dfe1ac9 to 1ec3db4 Compare August 27, 2026 08:01
@Max17190
Max17190 merged commit 309de8a into main Aug 27, 2026
7 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