Clean up html for keyhint text.

The \t was behaving the same as a space and the <b> was doing nothing.
This commit is contained in:
Ryan Roden-Corrent 2016-05-15 22:28:12 -04:00
parent 8eee5def5d
commit 3cd252ef82
2 changed files with 7 additions and 7 deletions

View File

@ -107,9 +107,9 @@ class KeyHintView(QLabel):
suffix = "<font color='{}'>{}</font>".format(suffix_color,
html.escape(key[len(prefix):]))
text += '{}{}\t<b>{}</b><br>'.format(html.escape(prefix),
suffix,
html.escape(cmd))
text += '{}{} {}<br>'.format(html.escape(prefix),
suffix,
html.escape(cmd))
self.setText(text)
self.adjustSize()

View File

@ -60,7 +60,7 @@ class TestKeyHintView:
('xe', 'cmd-xe')]))
keyhint.update_keyhint('normal', 'a')
line = "a<font color='{}'>{}</font>\t<b>{}</b><br>"
line = "a<font color='{}'>{}</font> {}<br>"
assert keyhint.text() == (line.format('yellow', 'a', 'cmd-aa') +
line.format('yellow', 'b', 'cmd-ab') +
line.format('yellow', 'ba', 'cmd-aba') +
@ -75,12 +75,12 @@ class TestKeyHintView:
('<ctrl-a>', 'cmd-aba')]))
keyhint.update_keyhint('normal', '<')
line = "&lt;<font color='{}'>{}</font>\t<b>{}</b><br>"
line = "&lt;<font color='{}'>{}</font> {}<br>"
assert keyhint.text() == (line.format('yellow', 'a', 'cmd-aa') +
line.format('yellow', 'b', 'cmd-ab'))
def test_disable(self, qtbot, keyhint, config_stub):
"""Ensure the a prefix of '<' doesn't suggest special keys"""
"""Ensure the widget isn't visible if disabled."""
config_stub.set('ui', 'show-keyhints', False)
keyhint.update_keyhint('normal', 'a')
assert not keyhint.text()
@ -92,5 +92,5 @@ class TestKeyHintView:
key_config_stub.set_bindings_for('normal', OrderedDict([
('aa', 'cmd-aa')]))
keyhint.update_keyhint('normal', 'a')
expected = "a<font color='#ABCDEF'>a</font>\t<b>cmd-aa</b><br>"
expected = "a<font color='#ABCDEF'>a</font> cmd-aa<br>"
assert keyhint.text() == expected