Repository navigation
Keep surrogate pairs intact when wrapping help text - #195
Merged
puzrin merged 1 commit intoOct 24, 2026
Merged
Conversation
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.
Wrapping a long help description can split a valid UTF-16 surrogate pair across lines. For example, a formatter with
width: 23and a description of twenty repeated emoji produces a dangling high surrogate before the newline and a dangling low surrogate after it. Encoding that help output replaces the two halves with replacement characters.Keep the long-word split boundary outside a surrogate pair. If an otherwise empty line has room for only one code unit, consume the whole pair so wrapping still advances. Remove an exhausted chunk and leave a full current line alone when the adjusted split has no room. Width accounting otherwise follows the existing code-unit approach.
Add eight port-specific cases covering odd boundaries, prefixed text, width one, a fractional width, unaffected ASCII/aligned cases, and the public
format_help()output. Add a changelog entry.Validation on Windows / Node.js 24.15.0 against
40086ea:npm test: ESLint and all 1,910 tests pass.git diff --checkpasses.Other Node versions and operating systems were not run locally.