fix(cli): collapse only large pasted chunks instead of the whole prompt - #2529
Closed
francip wants to merge 1 commit into
Closed
fix(cli): collapse only large pasted chunks instead of the whole prompt#2529francip wants to merge 1 commit into
francip wants to merge 1 commit into
Conversation
francip
force-pushed
the
kortexa/fix-paste-collapse-detection
branch
3 times, most recently
from
March 27, 2026 16:40
3f62814 to
32874a3
Compare
francip
force-pushed
the
kortexa/fix-paste-collapse-detection
branch
5 times, most recently
from
April 5, 2026 01:16
7d97edf to
a74152c
Compare
francip
force-pushed
the
kortexa/fix-paste-collapse-detection
branch
4 times, most recently
from
April 11, 2026 03:06
42d3117 to
13168b8
Compare
francip
force-pushed
the
kortexa/fix-paste-collapse-detection
branch
from
April 15, 2026 06:45
13168b8 to
684e66c
Compare
francip
force-pushed
the
kortexa/fix-paste-collapse-detection
branch
from
April 20, 2026 03:09
684e66c to
91531b1
Compare
Contributor
Author
|
Superseded by upstream #3065 (feat(cli): preserve user input on multiline paste) and its follow-ups. The paste-collapse behavior change is already on main; remaining diff was only refactoring, not worth the churn. |
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.
Note: This PR was authored and tested by Avery - a Hermes agent, with guidance from @francip.
What Changed
Fixed Hermes CLI paste collapsing so it only collapses the actual pasted chunk instead of collapsing the entire in-progress prompt based on total buffer size.
Files:
cli.py,hermes_cli/paste_collapse.py,tests/test_cli_paste_collapse.pyChanges:
BracketedPastehandler, where the actual pasted text is availableshould_collapse_pasted_textwrite_pasted_text_referencematerialize_paste_for_insertionexpand_paste_referenceson_text_changedcollapse heuristicWhy
Paste collapsing is useful for genuinely large pasted blocks, but the previous implementation used the total prompt content as the trigger. That meant a user could type a long multi-line draft, paste a tiny snippet, and have the whole prompt unexpectedly collapsed into a
[Pasted text ...]reference.This change makes the behavior match user intent:
Example
Before:
After:
Screenshot
Fixed behavior: a large pasted chunk is collapsed into a placeholder while the surrounding draft remains intact and editable.
How to Test
Then try:
Then try:
[Pasted text ...]placeholderValidation
Automated:
source venv/bin/activate python -m pytest tests/test_cli_paste_collapse.py tests/test_cli_init.py tests/test_cli_provider_resolution.py tests/test_cli_secret_capture.py -qResult:
42 passedRegression coverage added:
Platforms Tested
✅ macOS CLI
This change is isolated to CLI paste handling and paste-reference expansion, so it should remain portable across platforms using the same prompt_toolkit flow.