Fix binding of special keys with lower-case mods.
This commit is contained in:
parent
982733e1f4
commit
a6e3199616
@ -362,17 +362,18 @@ def normalize_keystr(keystr):
|
|||||||
Return:
|
Return:
|
||||||
The normalized keystring.
|
The normalized keystring.
|
||||||
"""
|
"""
|
||||||
|
keystr = keystr.lower()
|
||||||
replacements = (
|
replacements = (
|
||||||
('Control', 'Ctrl'),
|
('control', 'ctrl'),
|
||||||
('Windows', 'Meta'),
|
('windows', 'meta'),
|
||||||
('Mod1', 'Alt'),
|
('mod1', 'alt'),
|
||||||
('Mod4', 'Meta'),
|
('mod4', 'meta'),
|
||||||
)
|
)
|
||||||
for (orig, repl) in replacements:
|
for (orig, repl) in replacements:
|
||||||
keystr = keystr.replace(orig, repl)
|
keystr = keystr.replace(orig, repl)
|
||||||
for mod in ('Ctrl', 'Meta', 'Alt', 'Shift'):
|
for mod in ('ctrl', 'meta', 'alt', 'shift'):
|
||||||
keystr = keystr.replace(mod + '-', mod + '+')
|
keystr = keystr.replace(mod + '-', mod + '+')
|
||||||
return keystr.lower()
|
return keystr
|
||||||
|
|
||||||
|
|
||||||
class FakeIOStream(io.TextIOBase):
|
class FakeIOStream(io.TextIOBase):
|
||||||
|
@ -337,6 +337,8 @@ class TestNormalize:
|
|||||||
('Mod4+x', 'meta+x'),
|
('Mod4+x', 'meta+x'),
|
||||||
('Control--', 'ctrl+-'),
|
('Control--', 'ctrl+-'),
|
||||||
('Windows++', 'meta++'),
|
('Windows++', 'meta++'),
|
||||||
|
('ctrl-x', 'ctrl+x'),
|
||||||
|
('control+x', 'ctrl+x')
|
||||||
)
|
)
|
||||||
|
|
||||||
@pytest.mark.parametrize('orig, repl', STRINGS)
|
@pytest.mark.parametrize('orig, repl', STRINGS)
|
||||||
|
Loading…
Reference in New Issue
Block a user