Skip to content

fix: handle paste events in pair and rename inputs - #22

Merged
gitcoder89431 merged 1 commit into
mainfrom
fix/paste-in-pair-rename-inputs
May 26, 2026
Merged

fix: handle paste events in pair and rename inputs#22
gitcoder89431 merged 1 commit into
mainfrom
fix/paste-in-pair-rename-inputs

Conversation

@gitcoder89431

Copy link
Copy Markdown
Owner

Problem

Pressing p on the Connect screen opens the pair-by-ID input, but Cmd+V / Ctrl+V to paste a device ID did nothing. Same issue with the rename input (r). You had to type the full ID manually.

Root cause

PasteMsg is a distinct message type in Bubbletea v2 — it never routes through KeyPressMsg. The Update switch only handled tea.KeyPressMsg, so paste events were silently dropped.

Fix

Added a tea.PasteMsg case in Update that appends to pairInput or renameInput when the respective mode is active. Non-printable characters are filtered out (same policy as the key handler).

case tea.PasteMsg:
    text := strings.Map(func(r rune) rune {
        if unicode.IsPrint(r) { return r }
        return -1
    }, msg.Content)
    if c.pairing {
        c.pairInput += text
    } else if c.renaming {
        c.renameInput += text
    }

Testing

  • p → paste a full device ID → enter → device added ✓
  • r → paste a new name → enter → device renamed ✓
  • All existing tests pass

🤖 Generated with Claude Code

PasteMsg is a distinct message type in Bubbletea v2 — it never routes
through KeyPressMsg, so Cmd+V was silently dropped. Add a PasteMsg case
in Update that appends to pairInput or renameInput when the respective
mode is active, filtering non-printable characters.

Fixes: p key pair input, r rename input both now accept paste.
@gitcoder89431
gitcoder89431 merged commit 3d83dc7 into main May 26, 2026
2 checks passed
@gitcoder89431
gitcoder89431 deleted the fix/paste-in-pair-rename-inputs branch May 26, 2026 07:15
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.

1 participant