mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-11-13 12:09:35 +03:00
Update wcswidth() to match new country flag rendering
This commit is contained in:
parent
24197dc422
commit
6357f7b811
@ -1882,6 +1882,8 @@ screen_wcswidth(PyObject UNUSED *self, PyObject *str) {
|
||||
ans -= 1;
|
||||
prev_width = 1;
|
||||
} else prev_width = 0;
|
||||
} else if (is_flag_pair(prev_ch, ch)) {
|
||||
prev_width = 2;
|
||||
} else {
|
||||
int w = wcwidth_std(ch);
|
||||
switch(w) {
|
||||
|
@ -359,6 +359,9 @@ class TestDataTypes(BaseTest):
|
||||
self.ae(wcswidth('\033a\033[2mb'), 2)
|
||||
self.ae(wcswidth('\u25b6\ufe0f'), 2)
|
||||
self.ae(wcswidth('\U0001f610\ufe0e'), 1)
|
||||
self.ae(wcswidth('\U0001f1e6a'), 3)
|
||||
self.ae(wcswidth('\U0001F1E6a\U0001F1E8a'), 6)
|
||||
self.ae(wcswidth('\U0001F1E6\U0001F1E8a'), 3)
|
||||
# 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))
|
||||
|
Loading…
Reference in New Issue
Block a user