Switch title handling to use unicode

This commit is contained in:
Kovid Goyal 2016-11-23 20:28:30 +05:30
parent 91f80a3c85
commit 101afd5031
3 changed files with 3 additions and 3 deletions

View File

@ -150,7 +150,7 @@ class Boss(Thread):
def render(self):
if self.pending_title_change is not None:
t, self.pending_title_change = sanitize_title(self.pending_title_change or appname), None
glfw.glfwSetWindowTitle(self.window, t)
glfw.glfwSetWindowTitle(self.window, t.encode('utf-8'))
if self.pending_icon_change is not None:
self.pending_icon_change = None # TODO: Implement this
self.char_grid.render()

View File

@ -35,7 +35,7 @@ def timeit(name, do_timing=False):
def sanitize_title(x):
return re.sub(br'\s+', b' ', re.sub(br'[\0-\x19]', b'', x))
return re.sub(r'\s+', ' ', re.sub(r'[\0-\x19]', '', x))
def get_logical_dpi():

View File

@ -266,7 +266,7 @@ class TestDataTypes(BaseTest):
def test_utils(self):
self.ae(tuple(map(wcwidth, 'a1\0')), (1, 1, 0, 2))
self.assertEqual(sanitize_title(b'a\0\01 \t\n\f\rb'), b'a b')
self.assertEqual(sanitize_title('a\0\01 \t\n\f\rb'), 'a b')
def test_color_profile(self):
c = ColorProfile()