Repository navigation
refactor!: measure display width via breakword instead of wcwidth - #27
Merged
Merged
Conversation
Drops the wcwidth dependency; width comes from breakword.width() (public export, PR tecfu/breakword#24), which ships its own generated East Asian Width + Emoji_Presentation table with no deps. Behavior change: code points wcwidth 1.x scored 1 but breakword scores 2 (e.g. U+26A1 high voltage) now wrap as 2 cells. Test 18 expectation updated accordingly. - package.json: wcwidth -> breakword ^2.1.0 - types/wcwidth.d.ts -> types/breakword.d.ts - main.ts: string width summed per code point via breakword.width
breakword@2.1.0 declares engines >=22; declare the same floor instead of claiming support we do not control. CI matrix trimmed to 22/24/26.
Owner
Author
|
Unblocked — merge-ready. The gating dependency has shipped: breakword 2.1.0 is merged and published ( Re-verified against the published package (fresh registry install, no local symlinks):
Also pushed |
Under Breaking changes in 3.0.0: width now comes from breakword.width() (Unicode 18 generated table + Emoji_Presentation); code points wcwidth 1.x scored 1 but measure 2 (e.g. U+26A1) now wrap wider.
tecfu
added a commit
that referenced
this pull request
Sep 20, 2026
Version bump for the breakword switch (PR #27): display width now measured by breakword.width() instead of wcwidth, plus the engines floor (Node >=22). Published as v4.0.0.
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.
Why
wcwidth@1.xships a stale, hand-maintained East Asian Width table. breakword (post tcfu/breakword#22) removed its own wcwidth dependency in favor of a generated Unicode-18.0.0 W/F table plus UAX #51Emoji_Presentation, with explicit zero-width rules. Depending on breakword for width instead of duplicating that table keeps both packages consistent — one width policy, one generated table, one place to regenerate.Requires the public
widthexport: tecfu/breakword#24. That PR must merge and publish as 2.1.0 before this can be merged/released.What
package.json:wcwidth→breakword@^2.1.0src/main.ts:wcwidth(string)replaced bybreakword.width(char)summed per code point; per-character chunking callsbreakword.widthdirectlytypes/wcwidth.d.ts→types/breakword.d.ts(same shim pattern)Behavior changes
Width policy differences that surface in output:
LordPablo⚡️@ width 10) expectation updated: 11 cells → the emoji moves to its own line. This matches how modern terminals actually render it.resultvariable #21). Fine for wrapping; revisit if it bites.Tests
npm test— 25 passing. Breakword was installed vianpm install ../breakword --no-savefor local verification; CI/merge needs 2.1.0 published.Note
npm run lintis broken independently of this change (.eslintrc.jslacksroot: true, so ESLint 8 cascades past the repo to a stray~/Documents/.eslintrc.jsonrequiring@nx/eslint-plugin). Not touched here.