Repository navigation
Conversation
Contributor
|
The following comment was made by an LLM, it may be inaccurate: |
Contributor
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
Author
|
Closing: author decided not to pursue upstream submission. |
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.
What does this PR do?
Closes #8501.
Pasting again while the cursor sits on a collapsed paste placeholder (
[Pasted ~N lines]) expands it back into the original text instead of inserting new clipboard content. This mirrors the behavior users know from other CLI agents: paste collapses, pressing paste again expands.Demo
Buffer:
check [Pasted ~3 lines](cursor right after the placeholder) -> Cmd+V ->check alpha\nbeta\ngammaWhy this design
prompt.pastecommand and the bracketed-paste path, so the same shortcut that created the placeholder toggles it back. This keeps keybinds clean (a concern raised on feat(tui): Allow to expand pasted text (AKA "pasted summary") #8496) and gives the interaction for free on both paths.prompt.pastedispatch (clipboard read) and terminal bracketed paste (onPaste), which is what Cmd+V produces in iTerm/Terminal.pasteTextinserts). Moving the cursor elsewhere and pasting inserts clipboard content as before.prompt-parttypeId are ignored, so pasting over an[Image 1]badge still pastes.Implementation
packages/tui/src/prompt/part.ts: addspastedTextExtmarkAtOffset(cursor-on-placeholder check incl. the trailing space) andexpandPastedTextPlaceholder(finds the text-part extmark at the cursor, deletes the placeholder range, re-inserts the stored text in place, keeps remaining extmarks adjusted by the buffer's own hooks).packages/tui/src/component/prompt/index.tsx: calls it at the top of theprompt.pastecommand and theonPastehandler; on expansion it re-syncs prompt parts so the removed text part is dropped and other parts keep their ranges.How did you verify your code works?
packages/tui/test/prompt/paste-expand.test.tsx: offset matching, single expansion with cursor position check, no-op second paste, expanding only the placeholder under the cursor when several exist, and ignoring non-text extmarks (e.g. file badges).bun testinpackages/tui: 199 tests pass,bun typecheckclean.