Skip to content

Conversation

@jquast
Copy link

@jquast jquast commented Jan 24, 2026

Replacing grapheme_clusters with wcwidth.iter_grapheme() (new in wcwidth 0.3.0), we are able to correct a few errors shown by these new tests:

FAILED tests/test_screen.py::test_flag_emoji_40_in_80_columns - AssertionError: assert '🇺' == '🇺🇸'
FAILED tests/test_screen.py::test_grapheme_cluster_in_context[hangul_lv] - AssertionError: assert 'ᄀ' in ('가', '각', 'f')
FAILED tests/test_screen.py::test_grapheme_cluster_in_context[hangul_lvt] - AssertionError: assert '가' in ('가', '각', 'f')
FAILED tests/test_screen.py::test_regional_indicator_graphemes - AssertionError: assert '🇺' == '🇺🇸'

Also, wcwidth is now fully typed, so # type: ignore[import-untyped] is removed

And there have been many performance improvements in recent releases to benefit from ! As well as support for more complex languages (Brahmic scripts) and wcwidth.iter_grapheme() supports all of the world's languages, whereas the current implementation appears focused only on emoji

@jquast jquast changed the title better grapheme and emoji (regional indicator) support Improve grapheme and emoji flags (regional indicators) support Jan 25, 2026
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.

1 participant