...
This commit is contained in:
parent
348cdf5d5d
commit
a9e26952e9
@ -1251,9 +1251,10 @@ screen_wcswidth(Screen UNUSED *self, PyObject *str) {
|
|||||||
if (PyUnicode_READY(str) != 0) return NULL;
|
if (PyUnicode_READY(str) != 0) return NULL;
|
||||||
int kind = PyUnicode_KIND(str);
|
int kind = PyUnicode_KIND(str);
|
||||||
void *data = PyUnicode_DATA(str);
|
void *data = PyUnicode_DATA(str);
|
||||||
Py_ssize_t len = PyUnicode_GET_LENGTH(str), ans = 0, i;
|
Py_ssize_t len = PyUnicode_GET_LENGTH(str), i;
|
||||||
for (i = 0; i < len; i++) ans += wcwidth_impl(PyUnicode_READ(kind, data, i));
|
unsigned long ans = 0;
|
||||||
return PyLong_FromSsize_t(ans);
|
for (i = 0; i < len; i++) ans += safe_wcwidth(PyUnicode_READ(kind, data, i));
|
||||||
|
return PyLong_FromUnsignedLong(ans);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user