Repository navigation
fix(core): keep control characters out of multi-line input - #638
Merged
43081j merged 3 commits intoNov 11, 2026
Merged
Conversation
The key handler inserted every keypress that carries a character. Named keys are reported with their raw sequence, so backspace at the start of the input inserted DEL and ctrl+key combinations inserted their control character. Terminals do not draw them, but they were returned in the value.
Tab and newline are control characters as well, but they are whitespace a multi-line value can contain, so they have to keep being inserted.
🦋 Changeset detectedLatest commit: 80ee1d0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
dreyfus92
reviewed
Nov 11, 2026
dreyfus92
left a comment
Member
There was a problem hiding this comment.
thanks, this looks right to me. i ran every control byte through real readline on main and on this branch, backspace at the start and ctrl combos are gone and tab and newline still work, and defaultValue kicks in again after a lone backspace.
i would love @43081j's second opinion before we merge.
dreyfus92
approved these changes
Nov 11, 2026
Collaborator
|
seems fine to me 👍 |
commit: |
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
MultiLinePromptinserts every keypress that carries a character. For named keys Node passes the raw sequence as that character, so Backspace at the start of the input inserts\x7f, and Ctrl combinations such as Ctrl+A insert\x01–\x1a. Terminals don't draw them, but they are returned in the value. #637 has the repro.This PR only inserts characters that are text. Tab and newline behave as before, and no snapshots change.
50c8ea0) and pass with the fix. The third test pins tab and newline, so the check can't quietly grow too broad.\x7f \r \rtomultiline({ defaultValue: 'none' })returns a lone\x7fon 1.9.0 and"none"with this branch.pnpm test(804 passed),pnpm types,pnpm depsandpnpm formatpass.Closes #637
Type of change
Checklist
pnpm testpasses (or targeted tests for my change)pnpm formathas been runAI-generated code disclosure