feat(ui): inline short pastes, only collapse when >= 5 lines#60
Merged
Conversation
… >= 5 lines Previously every bracketed-paste, no matter how short, was replaced with a [Pasted ~1 line] placeholder — including single-line prompts of a couple hundred characters. This hid the actual content from both the user and the model. Mirror Hermes's behavior: inline short pastes (<5 lines) as plain text; only collapse longer multi-line pastes (logs, files, stack traces). Threshold lives in a single constant near the other paste markers so it can later be promoted to a config field if needed. Comparison with other agents: Claude Code: >= 4 lines opencode: >= 3 lines OR > 150 chars (community complaints too aggressive) Hermes: >= 5 lines (this PR) Cursor: ~10 lines / ~1 KB Aider: never collapses
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Every bracketed-paste — even a one-line prompt — was being replaced in the input box with a
[Pasted ~1 line]placeholder. Concretely, pasting:(1 line, ~230 chars) collapses to
[Pasted ~1 line]. The user can't see what they pasted, and the LLM only sees the decoded content at submit time — but the in-flight UX is broken for short snippets.Root cause:
findPasteBlocks(...) > 0triggered the collapse unconditionally — no threshold check at all.Fix
Mirror Hermes's behavior: only collapse pastes of >= 5 lines into a
[Pasted ~N lines]block. Shorter pastes get inserted as plain text so they render verbatim and behave like normal typed input.The threshold lives in a single named constant (
PASTE_COLLAPSE_LINE_THRESHOLD) right next to the other paste markers, so it's easy to promote to a config field later if needed.Comparison with other agents
Behavior table
[Pasted ~1 line]❌[Pasted ~2 lines][Pasted ~4 lines][Pasted ~5 lines][Pasted ~5 lines]✅[Pasted ~50 lines][Pasted ~50 lines]✅Test plan
npm run buildpasses[Pasted]placeholder[Pasted ~N lines]as beforeScope
Single-file change to
src/ui/app.tsx. No new dependencies. No behavior change for pastes that exceed the threshold.