Skip to content

Widen narrow emoji modifier sequences to two columns - #162

Merged
christianparpart merged 1 commit into
contour-terminal:masterfrom
trackd:feat/emoji-modifier-cluster-width
Nov 20, 2026
Merged

christianparpart merged 1 commit into
contour-terminal:masterfrom
trackd:feat/emoji-modifier-cluster-width

Conversation

@trackd

@trackd trackd commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Summary

grapheme_cluster_width() returns one column for ✌🏽 (U+270C U+1F3FD). The skin-tone modifier joins the grapheme cluster, but the width accumulator keeps the one-column width of bare ✌. Unicode defines the pair as a fully qualified emoji modifier sequence with emoji presentation. Unicode 17 emoji test data · UTS #51 §2.7.1

Update the shared width accumulator so a skin-tone modifier widens a one-column Emoji_Modifier_Base to two columns. The modifier still occupies no separate cell. The shared rule applies to both grapheme_cluster_width() and incremental scan_text().

Evidence

Input libunicode 0.9.5 Patched
Bare victory hand 270C 1 1
Victory hand with VS16 270C FE0F 2 2
Victory hand with medium skin tone 270C 1F3FD 1 2
Waving hand with medium skin tone 1F44B 1F3FD 2 2
Copyright sign with a skin-tone modifier 00A9 1F3FD 1 1

The baseline matched Contour’s cursor measurements for all 3,944 fully qualified Emoji 17 entries. The prototype corrected the 45 one-column results. All 3,944 then measured two columns through both width APIs, including when scanner input was split after the first code point. All 371 standardized VS16 pairs still measured two columns.

The width and split-scanner regressions fail on the baseline and pass with the patch. The full libunicode suite passed on Windows Release, including the Unicode 17 grapheme and word break conformance tests, with one pre-existing expected failure for a double-ZWJ case. The end-to-end check in a rebuilt Contour remains pending.

Compatibility

This changes parity with Python wcwidth 0.8.2 for affected modifier sequences. Applications that continue to measure those sequences as one column may disagree with terminals using the updated rule. Unicode specifies emoji presentation and leaves terminal column allocation to the implementation. The proposed width follows Contour’s two-column emoji convention. libunicode’s compatibility rationale · Terminal Unicode Core

Signed-off-by: trackd <17672644+trackd@users.noreply.github.com>
@christianparpart
christianparpart merged commit 994e426 into contour-terminal:master Nov 20, 2026
1 check passed
@trackd
trackd deleted the feat/emoji-modifier-cluster-width branch November 20, 2026 06:36
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.

2 participants