1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-22 22:42:48 +03:00

macos: populate caps lock state, report num lock presses

macos doesn't have a num lock concept, so there is no num lock state
reported in modifiers. wezterm doesn't emulate that state because it
cannot guarantee to observe all key presses and correctly track it.
This commit is contained in:
Wez Furlong 2023-04-10 16:25:53 -07:00
parent aa3f486a91
commit 5311bb657e
No known key found for this signature in database
GPG Key ID: 7A7F66A31EC9B387

View File

@ -383,6 +383,7 @@ fn function_key_to_keycode(function_key: char) -> KeyCode {
appkit::NSEndFunctionKey => KeyCode::End,
appkit::NSPageUpFunctionKey => KeyCode::PageUp,
appkit::NSPageDownFunctionKey => KeyCode::PageDown,
appkit::NSClearLineFunctionKey => KeyCode::NumLock,
value @ appkit::NSF1FunctionKey..=appkit::NSF35FunctionKey => {
KeyCode::Function((value - appkit::NSF1FunctionKey + 1) as u8)
}
@ -1679,6 +1680,9 @@ fn key_modifiers(flags: NSEventModifierFlags) -> Modifiers {
if flags.contains(NSEventModifierFlags::NSCommandKeyMask) {
mods |= Modifiers::SUPER;
}
if flags.bits() & (1 << 16) != 0 {
mods |= Modifiers::CAPS_LOCK;
}
mods
}