Make wcswidth ignore more escape codes
Needed to ignore OSC 8 hyperlinks since we will eventually have to send those with SGR formatting to the hints kitten.
This commit is contained in:
@@ -354,9 +354,11 @@ class TestDataTypes(BaseTest):
|
||||
def test_utils(self):
|
||||
def w(x):
|
||||
return wcwidth(ord(x))
|
||||
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)
|
||||
self.ae(tuple(map(w, 'a1\0コニチ ✔')), (1, 1, 0, 2, 2, 2, 1, 1))
|
||||
self.ae(wcswidth('\u2716\u2716\ufe0f\U0001f337'), 5)
|
||||
self.ae(wcswidth('\033a\033[2mb'), 2)
|
||||
self.ae(wcswidth('\u25b6\ufe0f'), 2)
|
||||
self.ae(wcswidth('\U0001f610\ufe0e'), 1)
|
||||
self.ae(wcswidth('\U0001f1e6a'), 3)
|
||||
|
||||
Reference in New Issue
Block a user