Switch title handling to use unicode
This commit is contained in:
parent
91f80a3c85
commit
101afd5031
@ -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()
|
||||
|
||||
@ -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():
|
||||
|
||||
@ -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()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user