[PR #8496] feat(tui): Allow to expand pasted text (AKA "pasted summary") #12764

Open
opened 2026-02-16 18:17:39 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/8496

State: open
Merged: No


What does this PR do?

Allows you to toggle the paste summary feature on and off to view and edit the contents of the pasted text.

This mainly fixes:

And helps with:

Demo

https://github.com/user-attachments/assets/54b6e2ef-01f3-42ff-99d6-fdbeb9e925d1

Why I created this PR

  1. I love that pasted text is summarized to avoid bloating the prompt, but I usually want to edit it or at least view it before sending the prompt.
  2. I know I can use my editor (leader + e) to edit text, but it's not as convenient for small edits.
  3. I did not find any issues referencing this, and I know I should have created one first, but OpenCode has made it so easy to fix small quirks like this... so here I am :D
  4. I created the issue after the PR: https://github.com/anomalyco/opencode/issues/8501

Decisions taken

  • The default state for it is the value of experimental.disable_paste_summary, if not available, it falls back to the current behavior (paste shows summary, not content)
  • The default keybind for this is ctrl+o
  • The name of this feature is "Paste summary" in order to be consistent with the existing experimental flag
  • When expanding the pasted text, it remains highlighted in yellow
  • When the cursor is in the middle of some expanded text and the user summarizes it, the cursor jumps right after "[Pasted ~1 lines]"

Things needed before merging

  • Agreement on how to name this feature ("Paste summary?")
  • UI decision on showing the expanded text as yellow or not (I like it but it can be too yellow)
  • Agreement on the default keybind, or leave it unmapped

How did you verify your code works?

  • Added unit tests
  • bun dev and manually tested it the different use cases
    • 1 pasted text
    • Multiple pasted texts
    • Pasted text with no line breaks
    • Pasted text with line breaks
    • Edit the pasted text and summarise it back
    • Paste text, edit it, open the editor (leader e)
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/8496 **State:** open **Merged:** No --- ### What does this PR do? Allows you to toggle the paste summary feature on and off to view and edit the contents of the pasted text. This mainly fixes: - https://github.com/anomalyco/opencode/issues/8501 And helps with: - https://github.com/anomalyco/opencode/issues/2425 - https://github.com/anomalyco/opencode/issues/4695 - https://github.com/anomalyco/opencode/issues/1386 - https://github.com/anomalyco/opencode/issues/2551 - https://github.com/anomalyco/opencode/issues/5687 #### Demo https://github.com/user-attachments/assets/54b6e2ef-01f3-42ff-99d6-fdbeb9e925d1 ### Why I created this PR 1. I love that pasted text is summarized to avoid bloating the prompt, but I usually want to edit it or at least view it before sending the prompt. 2. I know I can use my editor (leader + e) to edit text, but it's not as convenient for small edits. 3. I did not find any issues referencing this, and I know I should have created one first, but OpenCode has made it so easy to fix small quirks like this... so here I am :D 4. I created the issue after the PR: https://github.com/anomalyco/opencode/issues/8501 ### Decisions taken - The default state for it is the value of `experimental.disable_paste_summary`, if not available, it falls back to the current behavior (paste shows summary, not content) - The default keybind for this is `ctrl+o` - The name of this feature is "Paste summary" in order to be consistent with the existing experimental flag - When expanding the pasted text, it remains highlighted in yellow - When the cursor is in the middle of some expanded text and the user summarizes it, the cursor jumps right after "[Pasted ~1 lines]" ### Things needed before merging - [ ] Agreement on how to name this feature ("Paste summary?") - [ ] UI decision on showing the expanded text as yellow or not (I like it but it can be too yellow) - [ ] Agreement on the default keybind, or leave it unmapped ### How did you verify your code works? - Added unit tests - `bun dev` and manually tested it the different use cases - 1 pasted text - Multiple pasted texts - Pasted text with no line breaks - Pasted text with line breaks - Edit the pasted text and summarise it back - Paste text, edit it, open the editor (leader e)
yindo added the pull-request label 2026-02-16 18:17:39 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12764