Skip to content

Fix doubled keystrokes in the apply form after a resize - #146

Merged
kanetronv2 merged 1 commit into
mainfrom
fix-apply-form-resize
Nov 4, 2026
Merged

kanetronv2 merged 1 commit into
mainfrom
fix-apply-form-resize

Conversation

@kanetronv2

Copy link
Copy Markdown
Contributor

Problem

An applicant reported that the terminal application's name field "kept duplicating characters."

To reproduce: open /#apply-1, start typing a name, then change the terminal width (resize the window or rotate a phone). Every key after that is echoed twice; typing "Doe" shows DDooee.

Cause

A width change wipes the terminal and replays history. History replay skips interactive commands (NO_REPLAY), but deep links aren't in history, and runDeepLink({ replay: true }) only skipped tui. So the resize started a second apply form, and its onData listener stacked on the live one.

Fix

  • runDeepLink now skips every NO_REPLAY command on replay.
  • collectInput records its pending question in term.activeInput. After a resize, resizeListener redraws that question and the text typed so far. Before, it drew a shell prompt while keystrokes still went into the form.

Testing

  • Two new regression tests in tests/terminal-ext.test.js. Both failed before the change; npm test passes (457).
  • Checked in Chrome against a local build, for both the deep link and a typed apply 1. After a resize, typing isn't doubled and the screen shows What's your name?: Jane Doe. The form was cancelled each time, not submitted.

🤖 Generated with Claude Code

Opening the form via a deep link (/#apply-1) and then changing the
terminal width reran `apply`: runDeepLink's replay only skipped `tui`,
not the rest of NO_REPLAY. The second form's input listener stacked on
the first, so every character was echoed twice.

Also redraw the pending form question and typed text after a resize,
instead of a shell prompt that hid the still-active form.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kanetronv2
kanetronv2 merged commit 736a724 into main Nov 4, 2026
6 checks passed
@kanetronv2
kanetronv2 deleted the fix-apply-form-resize branch November 4, 2026 18:35
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