Skip to content

feat: paste expand toggle - #41813

Closed
luchev wants to merge 3 commits into
anomalyco:devfrom
luchev:feat/paste-expand-toggle
Closed

luchev wants to merge 3 commits into
anomalyco:devfrom
luchev:feat/paste-expand-toggle

Conversation

@luchev

@luchev luchev commented Aug 11, 2026 •

Copy link
Copy Markdown

Issue for this PR

#8501

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Pasted text can be toggled between placeholder and full text by mouse click.

How did you verify your code works?

Manually tested

Screenshots / recordings

Before:
image

After:
image

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

luchev added 3 commits August 5, 2026 23:50
Multi-line pastes are collapsed into a [Pasted ~N lines] chip in the chat
input. Clicking the chip now toggles it between the placeholder and the
full pasted content inline. Submit and copy still use the full content
regardless of display state.
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. needs:title labels Aug 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hey! Your PR title Feat/paste expand toggle doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@luchev luchev changed the title Feat/paste expand toggle feat: paste expand toggle Aug 11, 2026
@github-actions github-actions Bot removed needs:title needs:compliance This means the issue will auto-close after 2 hours. labels Aug 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@github-actions

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

@github-actions github-actions Bot closed this Sep 11, 2026
hunterchristian added a commit to chipp-ai/opencode that referenced this pull request Sep 23, 2026
A pasted [Pasted ~N lines] placeholder in the prompt can now be
expanded to its full content and collapsed back -- click it, or run
"Expand/collapse pasted text" (prompt.paste.toggle) from the palette
or a keybind.

Ported from upstream anomalyco#8501 (325 reactions -- the
highest of any issue found across a full survey of this repo's open
issues). A trivial 1-file fix already merged upstream as anomalyco#39920 isn't
even on this fork's history and is a one-way, no-collapse expand
anyway, not the real ask. Richer attempts were all closed by the
automated PR-cleanup bot and never reviewed:

- PR anomalyco#41813 "paste expand toggle" is the primary source: a pasted-
  text part remembers its original placeholder so it can collapse
  again, the chip is swapped by deleting its extmark, replacing the
  selected text, and recreating the extmark over the new text.
- PR anomalyco#33700 fixed a real, separate bug reused as-is:
  expandPastedTextPlaceholders substituted text back in via
  String.replace(str, str2), which treats $&/$$/etc. in the pasted
  text as special replacement patterns and silently corrupts it --
  fixed by passing a replacer function instead of a literal string.
- PR anomalyco#37052 contributed only the idea of a palette command to expand
  chips (its own version was one-way, expand-all); this fork's
  version is a proper per-chip toggle.

New: older saved prompts with no stored placeholder can still be
expanded (anomalyco#41813's version would lock them collapsed-only). Two pure
functions (togglePastedText, replaceVirtualExtmarkText) were extracted
into packages/tui/src/prompt/part.ts so anomalyco#41813's logic is unit-
testable outside the full Prompt component.

Known gaps: the full Prompt component's mouse-click path has no
automated test (no existing fixture mounts it with SDK/sync/route
providers -- checked manually against a bare textarea instead);
clicking a chip's very last character can miss the same way it does
in anomalyco#41813; an expanded chip is viewable but not editable in place.

New tests in packages/tui/test/prompt/part.test.ts and a new
packages/tui/test/prompt/paste-toggle.test.tsx (using this repo's
existing testRender/mockMouse helpers). Verified against this fork's
current dev (not just the agent's own stale worktree base): bun
typecheck clean; full packages/tui suite 215 pass.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant