Skip to content

fix(tui): delete a paste placeholder whole on word and line deletes - #54457

Open
Nowaker wants to merge 1 commit into
anomalyco:v1from
Nowaker:paste-placeholder-delete
Open

Nowaker wants to merge 1 commit into
anomalyco:v1from
Nowaker:paste-placeholder-delete

Conversation

@Nowaker

@Nowaker Nowaker commented Oct 11, 2026

Copy link
Copy Markdown

Note: I'm aware v1 is now the maintenance branch and new features go to v2 only. This PR is here for others to use, and I'll submit the v2 version once I've migrated my whole plugin system to it.

Issue for this PR

None found; this is a bug in the prompt's placeholder handling.

Type of change

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

What does this PR do?

ctrl+w (or alt+backspace) right after a [Pasted ~5 lines] placeholder deletes only the last word of its label and leaves [Pasted ~5 in the prompt, detached from the pasted text. ctrl+u and ctrl+k do the same when the line edge cuts into a placeholder. Backspace and delete already remove it whole.

The cause is in @opentui/core: its extmark controller's deleteRange, which every word and line delete goes through, trims a virtual extmark instead of treating it as one unit. The fix is upstream as anomalyco/opentui#1628: deleteRange widens its range over every virtual extmark it cuts into. This PR backports it to the pinned 0.4.5 with patches/@opentui%2Fcore@0.4.5.patch until a release with the fix is adopted.

How did you verify your code works?

  • test/component/prompt-placeholder-delete.test.tsx: delete word backward and forward, delete to line end, and a range ending inside a placeholder each remove it whole. Three of the four fail without the patch.
  • bun typecheck and bun test in packages/tui.
  • In a real terminal through tmux, ctrl+w, alt+backspace, ctrl+u and ctrl+k each removed see [Pasted ~3 lines] down to see (or the empty prompt) in one press.

Checklist

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

This PR is AI generated, but under direct supervision and on request of @Nowaker.

ctrl+w (or alt+backspace) right after a "[Pasted ~5 lines]" placeholder
deleted only the last word of its label, leaving "[Pasted ~5 " behind
with the pasted text detached from it; ctrl+u and ctrl+k did the same
when the line edge cut into a placeholder. Backspace and delete already
removed it whole.

The cause is in @opentui/core: its extmark controller's deleteRange,
which every word and line delete goes through, trimmed a virtual
extmark instead of treating it as one unit. The fix is upstream as
anomalyco/opentui#1628; patches/@OpenTui%2Fcore@0.4.5.patch backports
it to the pinned 0.4.5 until a release with it is adopted. deleteRange
now widens its range over every virtual extmark it cuts into.
@github-actions github-actions Bot added needs:issue needs:compliance This means the issue will auto-close after 2 hours. labels Oct 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • No issue referenced. Please add Closes #<number> linking to the relevant issue.

Please edit this PR description to address the above within 72 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Nowaker added a commit to Nowaker/opencode that referenced this pull request Oct 11, 2026
Session record and five feature records for item 28: atomic
placeholder deletes (opentui#1628 backport), configurable paste
summary, raw paste on <leader>v, grouped prompt undo with fork ctrl+z
defaults, and the click-to-edit paste dialog, with their upstream v1
PRs anomalyco#54457-anomalyco#54460 and anomalyco#54463, key-byte measurements through Vibeterm's
tmux, and the vt-206 installs on desktop and m4max.

AI-Tool: opencode 1.18.34-vt-194-907b3bc518
AI-Model: anthropic/claude-opus-5-5
AI-Variant: high
AI-Platform: linux
AI-Harness: Vibeterm 9343cff
AI-Session-ID: ses_ed7634c31ffeH84yR0S99Ty8Nd
Nowaker added a commit to Nowaker/opencode that referenced this pull request Oct 11, 2026
Session record and five feature records for item 28: atomic
placeholder deletes (opentui#1628 backport), configurable paste
summary, raw paste on <leader>v, grouped prompt undo with fork ctrl+z
defaults, and the click-to-edit paste dialog, with their upstream v1
PRs anomalyco#54457-anomalyco#54460 and anomalyco#54463, key-byte measurements through Vibeterm's
tmux, and the vt-206 installs on desktop and m4max.

AI-Tool: opencode 1.18.34-vt-194-907b3bc518
AI-Model: anthropic/claude-opus-5-5
AI-Variant: high
AI-Platform: linux
AI-Harness: Vibeterm 9343cff
AI-Session-ID: ses_ed7634c31ffeH84yR0S99Ty8Nd

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs:compliance This means the issue will auto-close after 2 hours. needs:issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant