Skip to content

fix: support paste and safe backspace in OAuth token input#10

Merged
Davis10733 merged 1 commit intomainfrom
fix/setup-oauth-paste-support
Mar 29, 2026
Merged

fix: support paste and safe backspace in OAuth token input#10
Davis10733 merged 1 commit intomainfrom
fix/setup-oauth-paste-support

Conversation

@yeppyworld66
Copy link
Copy Markdown
Contributor

Problem

  1. Pasting tokens doesn't work — in raw mode, pasted text arrives as a multi-char buffer but the old code treated the entire chunk as a single character, so only the first char was processed.
  2. Backspace could visually eat the prompt — while the guard existed, the single-char processing meant edge cases with multi-byte sequences could slip through.

Fix

  • Iterate each character in the raw stdin chunk (for (const c of str)) so multi-char pastes (Cmd+V / Ctrl+V) are fully processed
  • Each pasted char gets its own * mask on screen
  • Backspace remains guarded by input.length > 0 — can never delete into the prompt text
  • Extracted finish() helper for clean teardown

Testing

  • Pasted a 28-char token → 28 *s displayed ✅
  • Backspace removes chars correctly ✅
  • Backspace stops at prompt boundary ✅
  • Enter submits and saves credentials ✅
  • yarn build
  • yarn test — 31/31 passing ✅

- Iterate each char in the raw stdin chunk so multi-char pastes
  (e.g. Cmd+V) are handled correctly instead of being dropped
- Backspace guard already prevents deleting into the prompt text
- Removed unused redraw helper
@Davis10733 Davis10733 merged commit c9f9840 into main Mar 29, 2026
1 check failed
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