Add MODIFIER_KEYS

This commit is contained in:
Andrew Kay
2019-07-03 20:35:04 -05:00
parent 1843ca5f87
commit 62fcccf951
2 changed files with 4 additions and 3 deletions

View File

@@ -281,6 +281,8 @@ KEY_MODIFIER_MAP = {
Key.CAPS_LOCK: KeyboardModifiers.CAPS_LOCK
}
MODIFIER_KEYS = set(KEY_MODIFIER_MAP.keys())
Keymap = namedtuple('Keymap', ['name', 'default', 'shift', 'alt', 'modifier_release'])
class Keyboard:

View File

@@ -11,7 +11,7 @@ import pyte
from .session import Session, SessionDisconnectedError
from .display import encode_ascii_character
from .keyboard import Key, get_ascii_character_for_key
from .keyboard import Key, get_ascii_character_for_key, MODIFIER_KEYS
VT100_KEY_MAP = {
Key.NOT: b'^',
@@ -130,8 +130,7 @@ class VT100Session(Session):
if keyboard_modifiers.is_alt():
# Ignore any modifiers... this would fall through and result in a warning
# if they are not explicitly ignored.
if key in [Key.LEFT_ALT, Key.RIGHT_ALT, Key.LEFT_SHIFT, Key.RIGHT_SHIFT,
Key.CAPS_LOCK]:
if key in MODIFIER_KEYS:
return None
bytes_ = VT100_KEY_MAP_ALT.get(key)