fix numlock and capslock interfering with mouse assignments
refs: https://github.com/wez/wezterm/issues/3514
follow up from eaab3d08ae
This commit is contained in:
3 files changed
+14
-4
No files matched your search
@@ -427,7 +427,9 @@ impl InputMap {
|
||||
|
||||
pub fn is_leader(&self, key: &KeyCode, mods: Modifiers) -> Option<std::time::Duration> {
|
||||
if let Some((leader_key, leader_mods, timeout)) = self.leader.as_ref() {
|
||||
if *leader_key == *key && *leader_mods == mods.remove_positional_mods() {
|
||||
if *leader_key == *key
|
||||
&& *leader_mods == mods.remove_positional_mods().remove_keyboard_status_mods()
|
||||
{
|
||||
return Some(timeout.clone());
|
||||
}
|
||||
}
|
||||
@@ -450,7 +452,7 @@ impl InputMap {
|
||||
};
|
||||
|
||||
table
|
||||
.get(&key.normalize_shift(mods.remove_positional_mods()))
|
||||
.get(&key.normalize_shift(mods.remove_positional_mods().remove_keyboard_status_mods()))
|
||||
.cloned()
|
||||
}
|
||||
|
||||
@@ -459,7 +461,10 @@ impl InputMap {
|
||||
event: MouseEventTrigger,
|
||||
mut mods: MouseEventTriggerMods,
|
||||
) -> Option<KeyAssignment> {
|
||||
mods.mods = mods.mods.remove_positional_mods();
|
||||
mods.mods = mods
|
||||
.mods
|
||||
.remove_positional_mods()
|
||||
.remove_keyboard_status_mods();
|
||||
self.mouse.get(&(event, mods)).cloned()
|
||||
}
|
||||
|
||||
|
||||
@@ -308,7 +308,7 @@ impl super::TermWindow {
|
||||
key_event: Option<&KeyEvent>,
|
||||
) -> bool {
|
||||
// We don't allow caps lock or num lock to influence key resolution at the GUI layer.
|
||||
let raw_modifiers = raw_modifiers - (Modifiers::CAPS_LOCK | Modifiers::NUM_LOCK);
|
||||
let raw_modifiers = raw_modifiers.remove_keyboard_status_mods();
|
||||
|
||||
if is_down && !leader_active {
|
||||
// Check to see if this key-press is the leader activating
|
||||
|
||||
@@ -698,6 +698,11 @@ impl Modifiers {
|
||||
| Self::RIGHT_SHIFT
|
||||
| Self::ENHANCED_KEY)
|
||||
}
|
||||
|
||||
/// Remove status indicators that are not true modifiers
|
||||
pub fn remove_keyboard_status_mods(self) -> Self {
|
||||
self - (Self::CAPS_LOCK | Self::NUM_LOCK)
|
||||
}
|
||||
}
|
||||
|
||||
/// These keycodes identify keys based on their physical
|
||||
|
||||
Reference in new issue
Block a user