Add support for Vs-15 to wcswidth
This commit is contained in:
parent
4fff84b4b9
commit
fe882dad15
@ -1734,6 +1734,11 @@ screen_wcswidth(PyObject UNUSED *self, PyObject *str) {
|
|||||||
ans += 1;
|
ans += 1;
|
||||||
prev_width = 2;
|
prev_width = 2;
|
||||||
} else prev_width = 0;
|
} else prev_width = 0;
|
||||||
|
} else if (ch == 0xfe0e) {
|
||||||
|
if (is_emoji_presentation_base(prev_ch) && prev_width == 2) {
|
||||||
|
ans -= 1;
|
||||||
|
prev_width = 1;
|
||||||
|
} else prev_width = 0;
|
||||||
} else {
|
} else {
|
||||||
int w = wcwidth_std(ch);
|
int w = wcwidth_std(ch);
|
||||||
switch(w) {
|
switch(w) {
|
||||||
|
|||||||
@ -344,6 +344,8 @@ class TestDataTypes(BaseTest):
|
|||||||
self.ae(tuple(map(w, 'a1\0コニチ ✔')), (1, 1, 0, 2, 2, 2, 1, 1))
|
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('\u2716\u2716\ufe0f\U0001f337'), 5)
|
||||||
self.ae(wcswidth('\033a\033[2mb'), 2)
|
self.ae(wcswidth('\033a\033[2mb'), 2)
|
||||||
|
self.ae(wcswidth('\u25b6\ufe0f'), 2)
|
||||||
|
self.ae(wcswidth('\U0001f610\ufe0e'), 1)
|
||||||
# Regional indicator symbols (unicode flags) are defined as having
|
# Regional indicator symbols (unicode flags) are defined as having
|
||||||
# Emoji_Presentation so must have width 2
|
# Emoji_Presentation so must have width 2
|
||||||
self.ae(tuple(map(w, '\U0001f1ee\U0001f1f3')), (2, 2))
|
self.ae(tuple(map(w, '\U0001f1ee\U0001f1f3')), (2, 2))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user