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:
|
||||
The normalized keystring.
|
||||
"""
|
||||
keystr = keystr.lower()
|
||||
replacements = (
|
||||
('Control', 'Ctrl'),
|
||||
('Windows', 'Meta'),
|
||||
('Mod1', 'Alt'),
|
||||
('Mod4', 'Meta'),
|
||||
('control', 'ctrl'),
|
||||
('windows', 'meta'),
|
||||
('mod1', 'alt'),
|
||||
('mod4', 'meta'),
|
||||
)
|
||||
for (orig, repl) in replacements:
|
||||
keystr = keystr.replace(orig, repl)
|
||||
for mod in ('Ctrl', 'Meta', 'Alt', 'Shift'):
|
||||
for mod in ('ctrl', 'meta', 'alt', 'shift'):
|
||||
keystr = keystr.replace(mod + '-', mod + '+')
|
||||
return keystr.lower()
|
||||
return keystr
|
||||
|
||||
|
||||
class FakeIOStream(io.TextIOBase):
|
||||
|
@ -337,6 +337,8 @@ class TestNormalize:
|
||||
('Mod4+x', 'meta+x'),
|
||||
('Control--', 'ctrl+-'),
|
||||
('Windows++', 'meta++'),
|
||||
('ctrl-x', 'ctrl+x'),
|
||||
('control+x', 'ctrl+x')
|
||||
)
|
||||
|
||||
@pytest.mark.parametrize('orig, repl', STRINGS)
|
||||
|
Loading…
Reference in New Issue
Block a user