Skip to content

feat(tui): expand pasted text - #39920

Merged
kitlangton merged 2 commits into
v2from
expand-pasted-text
Jul 31, 2026
Merged

feat(tui): expand pasted text#39920
kitlangton merged 2 commits into
v2from
expand-pasted-text

Conversation

@kitlangton

Copy link
Copy Markdown
Contributor

What

Allow collapsed pasted text in the TUI composer to be expanded without opening an editor:

  • click a [Pasted ~N lines] placeholder to expand it in place
  • paste the same content again to expand the existing placeholder instead of inserting a duplicate

Expansion affects only the selected or matching pasted block. Other pasted blocks, file mentions, and agent mentions remain tracked.

How

packages/tui/src/component/prompt/index.tsx now replaces a tracked pasted extmark with its original text, removes that pasted part from prompt metadata, and realigns later pasted-part indexes.

Mouse expansion resolves the exact extmark at the clicked cursor offset. Repeated paste expansion reuses the first collapsed pasted part whose normalized content matches the incoming paste.

Scope

This applies only to text that the composer would already collapse under the existing paste threshold. Short pastes and prompt.paste: "full" retain their current behavior. Attachments are unchanged.

Testing

  • bun typecheck in packages/tui
  • bun run test test/prompt/part.test.ts in packages/tui
  • push-hook workspace typecheck, 33 packages passed
  • OpenCode Drive walkthrough verified click-to-expand and repeat-paste-to-expand

Demo

Simulated OpenCode Drive session. Static control dead time was trimmed from the recording; interaction transitions remain at normal speed.

expand-pasted-text-demo.mp4

@kitlangton
kitlangton enabled auto-merge (squash) July 31, 2026 18:05
@kitlangton
kitlangton merged commit 3bfce3f into v2Jul 31, 2026
7 checks passed
@kitlangton
kitlangton deleted the expand-pasted-text branch July 31, 2026 18:17
github-actionsBot pushed a commit to ReStranger/opencode that referenced this pull request Jul 31, 2026
* upstream/v2:
fix(tui): render plugin slots and routes with component semantics (anomalyco#39917)
refactor(ai): simplify provider options (anomalyco#39924)
refactor(core): rename attachments config to media (anomalyco#39927)
feat(tui): expand pasted text (anomalyco#39920)
feat(ai): expand OpenRouter native support (anomalyco#39907)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@kitlangton