Skip to content

add bracketed paste support for TUI inputs#60

Open
evanbranigan-dotcom wants to merge 1 commit into
zingolabs:mainfrom
evanbranigan-dotcom:fix-bracketed-paste
Open

add bracketed paste support for TUI inputs#60
evanbranigan-dotcom wants to merge 1 commit into
zingolabs:mainfrom
evanbranigan-dotcom:fix-bracketed-paste

Conversation

@evanbranigan-dotcom

Copy link
Copy Markdown

Summary

  • Enable crossterm's bracketed paste mode on startup so pasted text arrives as a single Event::Paste(String) instead of individual key events
  • Handle Event::Paste in all three input components (MnemonicInput, PathInput, BirthdayInput)
  • Strip surrounding quotes from pasted paths (macOS adds quotes on file drag-and-drop)
  • Disable bracketed paste on both normal exit and panic hook

Problem

Without bracketed paste mode, the terminal sends pasted text character-by-character. This causes:

  • macOS: Dragging a file wraps the path in single quotes ('path')
  • Linux/KDE: A spurious j character is prepended (partial parse of the ESC[200~ sequence)
  • All platforms: Pasting a 24-word mnemonic triggers 100+ individual key events instead of one paste event

Changes

File Change
main.rs EnableBracketedPaste on startup, DisableBracketedPaste on exit + panic
mnemonic_input.rs Handle Event::Paste — type each character
input.rs (PathInput) Handle Event::Paste — strip quotes, type each character
birthday_input.rs Handle Event::Paste — type each character

No dependency changes — crossterm 0.29.0 (already in the lock file) has full support, and tuirealm 2.2.0 already surfaces Event::Paste(String).

Fixes #43

AI Disclosure

Claude (Anthropic) assisted with codebase analysis and patch authoring. All code was reviewed and understood by the committer.

Enable crossterm's bracketed paste mode so pasted text arrives as a
single Event::Paste(String) instead of individual key events. This
fixes garbled input when pasting mnemonics, file paths (macOS wraps
drag-and-drop paths in quotes), or birthday heights.

- Enable EnableBracketedPaste on startup, disable on exit and panic
- Handle Event::Paste in MnemonicInput, PathInput, BirthdayInput
- Strip surrounding quotes from pasted paths (macOS drag-and-drop)

Fixes zingolabs#43

AI Disclosure: Claude (Anthropic) assisted with codebase analysis and
patch authoring. All code was reviewed and understood by the committer.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

Add support for bracketed pastes

1 participant