From 531d3e60c654b4fab0acbc34589a4696697f7a4b Mon Sep 17 00:00:00 2001 From: ZyX Date: Fri, 5 Dec 2014 22:24:13 +0300 Subject: [PATCH] Fix code: unichr on UCS-2 builds cannot emit surrogate pairs --- powerline/lib/unicode.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/powerline/lib/unicode.py b/powerline/lib/unicode.py index 13073416..b100b18f 100644 --- a/powerline/lib/unicode.py +++ b/powerline/lib/unicode.py @@ -212,11 +212,7 @@ strwidth_ucs_4.__doc__ = _strwidth_documentation.format( def strwidth_ucs_2(width_data, string): return sum((( ( - width_data[ - east_asian_width( - unichr(surrogate_pair_to_character(ord(string[i - 1]), ord(symbol))) - ) - ] + width_data[east_asian_width(string[i - 1] + symbol)] ) if 0xDC00 <= ord(symbol) <= 0xDFFF else ( 0 ) if combining(symbol) or 0xD800 <= ord(symbol) <= 0xDBFF else (