mirror of
https://github.com/wez/wezterm.git
synced 2024-12-25 14:22:37 +03:00
parent
c544b0edce
commit
a562cb5a92
@ -1842,18 +1842,16 @@ impl KeyEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_ => {
|
_ => {
|
||||||
if self.key.is_modifier()
|
let code = self.raw.as_ref().and_then(|raw| raw.kitty_function_code());
|
||||||
&& !flags.contains(KittyKeyboardFlags::REPORT_ALL_KEYS_AS_ESCAPE_CODES)
|
|
||||||
{
|
match (
|
||||||
// Don't report bare modifier only key events unless
|
code,
|
||||||
// we're reporting all keys with escape codes
|
flags.contains(KittyKeyboardFlags::REPORT_ALL_KEYS_AS_ESCAPE_CODES),
|
||||||
String::new()
|
) {
|
||||||
} else if let Some(code) =
|
(Some(code), true) => {
|
||||||
self.raw.as_ref().and_then(|raw| raw.kitty_function_code())
|
format!("\x1b[{code};{modifiers}{event_type}{generated_text}u")
|
||||||
{
|
}
|
||||||
format!("\x1b[{code};{modifiers}{event_type}{generated_text}u")
|
_ => String::new(),
|
||||||
} else {
|
|
||||||
String::new()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2652,5 +2650,37 @@ mod test {
|
|||||||
.encode_kitty(flags),
|
.encode_kitty(flags),
|
||||||
" ".to_string()
|
" ".to_string()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
make_event_with_raw(
|
||||||
|
KeyEvent {
|
||||||
|
key: KeyCode::NumLock,
|
||||||
|
modifiers: Modifiers::NONE,
|
||||||
|
leds: KeyboardLedStatus::empty(),
|
||||||
|
repeat_count: 1,
|
||||||
|
key_is_down: true,
|
||||||
|
raw: None
|
||||||
|
},
|
||||||
|
Some(PhysKeyCode::NumLock)
|
||||||
|
)
|
||||||
|
.encode_kitty(flags),
|
||||||
|
"".to_string()
|
||||||
|
);
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
make_event_with_raw(
|
||||||
|
KeyEvent {
|
||||||
|
key: KeyCode::CapsLock,
|
||||||
|
modifiers: Modifiers::NONE,
|
||||||
|
leds: KeyboardLedStatus::empty(),
|
||||||
|
repeat_count: 1,
|
||||||
|
key_is_down: true,
|
||||||
|
raw: None,
|
||||||
|
},
|
||||||
|
Some(PhysKeyCode::CapsLock)
|
||||||
|
)
|
||||||
|
.encode_kitty(flags),
|
||||||
|
"".to_string()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user