From 195c4ab71173e2ffc3a68c514a2126337badadb4 Mon Sep 17 00:00:00 2001 From: Thomas Ballinger Date: Wed, 19 Nov 2014 14:37:00 -0500 Subject: [PATCH] take combining characters into account --- wcwidth/wcwidth.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wcwidth/wcwidth.py b/wcwidth/wcwidth.py index d7fe1db..8ed518c 100644 --- a/wcwidth/wcwidth.py +++ b/wcwidth/wcwidth.py @@ -182,6 +182,9 @@ def wcswidth(pwcs, n=None): for char in pwcs[idx]: wcw = wcwidth(char) if wcw < 0: + ucs = ord(char) + if _bisearch(ucs, NONZERO_COMBINING): + continue return -1 else: width += wcw