Make key macro more portable

pull/924/head
Nehliin 3 years ago committed by Blaž Hrastnik
parent a4c5f46739
commit da4d9340ba

@ -12,13 +12,13 @@ use std::{
#[macro_export] #[macro_export]
macro_rules! key { macro_rules! key {
($key:ident) => { ($key:ident) => {
KeyEvent { ::helix_view::input::KeyEvent {
code: ::helix_view::keyboard::KeyCode::$key, code: ::helix_view::keyboard::KeyCode::$key,
modifiers: ::helix_view::keyboard::KeyModifiers::NONE, modifiers: ::helix_view::keyboard::KeyModifiers::NONE,
} }
}; };
($($ch:tt)*) => { ($($ch:tt)*) => {
KeyEvent { ::helix_view::input::KeyEvent {
code: ::helix_view::keyboard::KeyCode::Char($($ch)*), code: ::helix_view::keyboard::KeyCode::Char($($ch)*),
modifiers: ::helix_view::keyboard::KeyModifiers::NONE, modifiers: ::helix_view::keyboard::KeyModifiers::NONE,
} }

Loading…
Cancel
Save