mirror of
https://github.com/wez/wezterm.git
synced 2024-11-23 15:04:36 +03:00
kitty keeb: use raw modifiers rather than normalized modifiers
refs: https://github.com/wez/wezterm/issues/2546
This commit is contained in:
parent
bdbedad38a
commit
5fc9349c92
@ -1628,17 +1628,23 @@ impl KeyEvent {
|
||||
}
|
||||
}
|
||||
|
||||
let raw_modifiers = self
|
||||
.raw
|
||||
.as_ref()
|
||||
.map(|raw| raw.modifiers)
|
||||
.unwrap_or(self.modifiers);
|
||||
|
||||
let mut modifiers = 0;
|
||||
if self.modifiers.contains(Modifiers::SHIFT) {
|
||||
if raw_modifiers.contains(Modifiers::SHIFT) {
|
||||
modifiers |= 1;
|
||||
}
|
||||
if self.modifiers.contains(Modifiers::ALT) {
|
||||
if raw_modifiers.contains(Modifiers::ALT) {
|
||||
modifiers |= 2;
|
||||
}
|
||||
if self.modifiers.contains(Modifiers::CTRL) {
|
||||
if raw_modifiers.contains(Modifiers::CTRL) {
|
||||
modifiers |= 4;
|
||||
}
|
||||
if self.modifiers.contains(Modifiers::SUPER) {
|
||||
if raw_modifiers.contains(Modifiers::SUPER) {
|
||||
modifiers |= 8;
|
||||
}
|
||||
if self.leds.contains(KeyboardLedStatus::CAPS_LOCK) {
|
||||
@ -2305,6 +2311,30 @@ mod test {
|
||||
"\x1b[105;6u".to_string()
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
KeyEvent {
|
||||
key: KeyCode::Char('I'),
|
||||
modifiers: Modifiers::CTRL,
|
||||
leds: KeyboardLedStatus::empty(),
|
||||
repeat_count: 1,
|
||||
key_is_down: true,
|
||||
raw: Some(RawKeyEvent {
|
||||
key: KeyCode::Char('I'),
|
||||
modifiers: Modifiers::SHIFT | Modifiers::CTRL,
|
||||
handled: Handled::new(),
|
||||
key_is_down: true,
|
||||
raw_code: 0,
|
||||
leds: KeyboardLedStatus::empty(),
|
||||
phys_code: Some(PhysKeyCode::I),
|
||||
#[cfg(windows)]
|
||||
scan_code: 0,
|
||||
repeat_count: 1,
|
||||
}),
|
||||
}
|
||||
.encode_kitty(flags),
|
||||
"\x1b[105;6u".to_string()
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
KeyEvent {
|
||||
key: KeyCode::Char('i'),
|
||||
|
Loading…
Reference in New Issue
Block a user