diff --git a/qutebrowser/keyinput/keyutils.py b/qutebrowser/keyinput/keyutils.py index 61e3e53b4..3518e53dd 100644 --- a/qutebrowser/keyinput/keyutils.py +++ b/qutebrowser/keyinput/keyutils.py @@ -40,7 +40,7 @@ _MODIFIER_MAP = { def is_printable(key): - return key <= 0xff + return key <= 0xff and key != Qt.Key_Space def is_modifier_key(key): @@ -221,7 +221,7 @@ class KeyInfo: modifiers &= ~_MODIFIER_MAP[self.key] elif is_printable(self.key): # "normal" binding - assert len(key_string) == 1 or self.key == Qt.Key_Space, key_string + assert len(key_string) == 1, key_string if self.modifiers == Qt.ShiftModifier: return key_string.upper() elif self.modifiers == Qt.NoModifier: diff --git a/tests/unit/keyinput/test_keyutils.py b/tests/unit/keyinput/test_keyutils.py index 7fc6cc12c..2e595c19a 100644 --- a/tests/unit/keyinput/test_keyutils.py +++ b/tests/unit/keyinput/test_keyutils.py @@ -122,6 +122,8 @@ class TestKeyToString: (Qt.Key_A, Qt.NoModifier, 'a'), (Qt.Key_A, Qt.ShiftModifier, 'A'), + (Qt.Key_Space, Qt.NoModifier, ''), + (Qt.Key_Space, Qt.ShiftModifier, ''), (Qt.Key_Tab, Qt.ShiftModifier, ''), (Qt.Key_A, Qt.ControlModifier, ''), (Qt.Key_A, Qt.ControlModifier | Qt.ShiftModifier, ''), @@ -180,9 +182,9 @@ def test_normalize_keystr(orig, normalized): (Qt.Key_Backspace, False), (Qt.Key_Return, False), (Qt.Key_Enter, False), + (Qt.Key_Space, False), (Qt.Key_X | Qt.ControlModifier, False), # Wrong usage - (Qt.Key_Space, True), # FIXME broken with upper/lower! (Qt.Key_ydiaeresis, True), (Qt.Key_X, True), ])