Skip to content

feat(terminal): send pastes with bracketed paste markers - #10

Merged
taigrr merged 1 commit into
taigrr:v2-bridgefrom
aldouus:bracketed-paste
Sep 4, 2026
Merged

feat(terminal): send pastes with bracketed paste markers#10
taigrr merged 1 commit into
taigrr:v2-bridgefrom
aldouus:bracketed-paste

Conversation

@aldouus

@aldouus aldouus commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Summary

:CrushPaste (and paste_selection) wrote the raw register text to the terminal channel, so Crush received it as individual keystrokes and large pastes took a long time to play out.

This wraps the text in bracketed paste markers (ESC[200~ … ESC[201~) so the TUI receives one paste event. Bubble Tea enables bracketed paste mode by default, so Crush inserts the block in a single operation.

Changes

  • terminal.bracketed(text): new helper returning the wrapped text.
  • paste() and paste_selection() send through it. Warnings and error paths are unchanged.
  • The duplicated buffer/channel validation in both functions is folded into a local get_term_chan().
  • Tests asserting the exact marker bytes for multiline and empty input.

Testing

  • tests/terminal_spec.lua: 13 passing.
  • Verified end to end in headless Neovim against a cat -v terminal job that the PTY receives ^[[200~ … ^[[201~ around the pasted text.

prompts.send() still sends raw text; it could reuse terminal.bracketed() if parity is wanted there.

🤖 Generated with Claude Code

:CrushPaste previously wrote the raw register or selection to the
terminal channel, so Crush received it as a stream of individual
keystrokes and large pastes took a long time to play out.

Wrap the text in ESC[200~ ... ESC[201~ so the TUI receives a single
paste event. Bubble Tea enables bracketed paste mode by default.

Also fold the duplicated buffer/channel validation in paste() and
paste_selection() into a local get_term_chan() helper.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@taigrr
taigrr merged commit 9abc2c9 into taigrr:v2-bridge Sep 4, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants