[PR #4030] tui: restore full text when editing prompts with summarized content #10844

Closed
opened 2026-02-16 18:15:35 -05:00 by yindo · 0 comments
Owner

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

State: closed
Merged: Yes


Closes https://github.com/sst/opencode/issues/4015

Fixed the handling of pasted content and non-textual attachments.

New behaviour:

  • Pasted textual content is expanded in the editor and remains expanded
  • images / files pasted are preserved unless the virtual text is deleted in the editor

Small concerns:

  1. To expand the text I used .replace on the virtual text. This assumes users will not type "[ Pasted 5 lines ]" in the prompt. A safer approach, perhaps, would be to do what the submit function does now and expand it based on the extmark locations. If going in this direction, we can consider extracting this into a helper function.
  2. This also uses .indexOf to search for the virtual text of images/files. Which could slightly break if the user type "[ Image 1 ]". I don't see a simple solution for this at the time.

As both scenarios seem unlikely, I'm leaving this in to leave the change minimal and avoid further complicating the code.
But if you would prefer me to amend one to the safer approach - let me know.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/4030 **State:** closed **Merged:** Yes --- Closes https://github.com/sst/opencode/issues/4015 Fixed the handling of pasted content and non-textual attachments. New behaviour: - Pasted textual content is expanded in the editor and remains expanded - images / files pasted are preserved unless the virtual text is deleted in the editor Small concerns: 1. To expand the text I used `.replace` on the virtual text. This assumes users will not type "[ Pasted 5 lines ]" in the prompt. A safer approach, perhaps, would be to do what the submit function does now and expand it based on the extmark locations. If going in this direction, we can consider extracting this into a helper function. 2. This also uses `.indexOf` to search for the virtual text of images/files. Which could slightly break if the user type "[ Image 1 ]". I don't see a simple solution for this at the time. As both scenarios seem unlikely, I'm leaving this in to leave the change minimal and avoid further complicating the code. But if you would prefer me to amend one to the safer approach - let me know.
yindo added the pull-request label 2026-02-16 18:15:35 -05:00
yindo closed this issue 2026-02-16 18:15:36 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10844