fix: cluster base + U+FE0F as a width-2 emoji glyph#84
Draft
natemoo-re wants to merge 3 commits into
Draft
Conversation
|
Size Increased — +0.2 KB 107.6 KB unpacked |
commit: |
measure() and render_text() summed per-codepoint widths with no grapheme awareness, so a base codepoint followed by U+FE0F (variation selector-16) measured as base-width + 0 instead of one width-2 emoji cluster. Add a one-codepoint lookahead to both loops: when the next codepoint is U+FE0F, treat the pair as a single width-2 cluster, place only the base glyph, and consume both. The wcwidth table is untouched. The repro's bordered-fit assertion was rescoped to the render path; the separate "fit() border does not reserve layout space" behavior is tracked in its own issue. Fixes #81
748a88e to
c164d29
Compare
Contributor
Merging this PR will degrade performance by 54.45%
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing |
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.
measure()andrender_text()summed per-codepoint widths with no grapheme awareness, so a base codepoint followed by U+FE0F (variation selector-16) measured as base-width + 0 instead of one width-2 emoji clusterwcwidthtable is untouchedfit()box rendering┌──────┐) was rescoped to the render path. It depended on a separate, pre-existing bug: afit()box's border does not reserve layout space, so even 6-wide ASCII content renders┌────┐. That behavior is independent of this fix and tracked separately (it conflicts with the committed border-overlay model and its tests)test/width.test.tsunderdescribe("emoji width")rather than a standalone file. fix: collapse orphaned wide-char lead on trailing-column overlay #86 also adds totest/width.test.ts(describe("wide characters")), so whichever merges second needs a trivial rebase to keep both describesdeno testgreen (8 passed / 148 steps);deno lint+deno fmt --checkclean