Port wcswidth to use grapheme segmentation

This commit is contained in:
Kovid Goyal
2025-04-04 11:09:35 +05:30
parent 2cad589f1c
commit 203e9f6c58
4 changed files with 73 additions and 100 deletions

View File

@@ -379,6 +379,7 @@ class TestDataTypes(BaseTest):
def test_utils(self):
def w(x):
return wcwidth(ord(x))
self.ae(wcswidth('\x9c'), 0)
self.ae(wcswidth('a\033[2mb'), 2)
self.ae(wcswidth('\033a\033[2mb'), 2)
self.ae(wcswidth('a\033]8;id=moo;https://foo\033\\a'), 2)