Rewrite wcswidth as a state machine

This commit is contained in:
Kovid Goyal
2020-04-07 10:10:30 +05:30
parent 0b9a37139e
commit 0862e85577
2 changed files with 47 additions and 31 deletions

View File

@@ -362,6 +362,7 @@ class TestDataTypes(BaseTest):
self.ae(wcswidth('\U0001f1e6a'), 3)
self.ae(wcswidth('\U0001F1E6a\U0001F1E8a'), 6)
self.ae(wcswidth('\U0001F1E6\U0001F1E8a'), 3)
self.ae(wcswidth('\U0001F1E6\U0001F1E8\U0001F1E6'), 4)
# Regional indicator symbols (unicode flags) are defined as having
# Emoji_Presentation so must have width 2
self.ae(tuple(map(w, '\U0001f1ee\U0001f1f3')), (2, 2))