Suggestions for infobox changes

Co-authored-by: Benoît Cortier <benoit.cortier@fried-world.eu>
pull/412/head
Ivan Tham 3 years ago committed by Blaž Hrastnik
parent 8985c58fd3
commit 4c190ec9d9

@ -3406,18 +3406,18 @@ macro_rules! mode_info {
// TODO: how to use one expr for both pat and expr? // TODO: how to use one expr for both pat and expr?
// TODO: how to use replaced function name as str at compile time? // TODO: how to use replaced function name as str at compile time?
// TODO: extend to support multiple keys, but first solve the other two // TODO: extend to support multiple keys, but first solve the other two
{$name:literal, $cx:expr, $($key:expr => $func:expr; $funcs:literal),+,} => { {$name:literal, $cx:expr, $($key:expr => $func:expr; $desc:literal),+,} => {
mode_info! { mode_info! {
$name, $cx, $name, $cx,
$($key; $key => $func; $funcs,)+ $($key; $key => $func; $desc,)+
} }
}; };
{$name:literal, $cx:expr, $($key:expr; $keyp:pat => $func:expr; $funcs:literal),+,} => { {$name:literal, $cx:expr, $($key:expr; $keyp:pat => $func:expr; $desc:literal),+,} => {
$cx.editor.autoinfo = Some(Info::key( $cx.editor.autoinfo = Some(Info::key(
$name, $name,
vec![ vec![
$( $(
(vec![$key], $funcs), (vec![$key], $desc),
)+ )+
], ],
)); ));

@ -105,14 +105,14 @@ use std::{
macro_rules! key { macro_rules! key {
($key:ident) => { ($key:ident) => {
KeyEvent { 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 { 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,
} }
}; };
} }
@ -120,8 +120,8 @@ macro_rules! key {
macro_rules! ctrl { macro_rules! ctrl {
($($ch:tt)*) => { ($($ch:tt)*) => {
KeyEvent { KeyEvent {
code: helix_view::keyboard::KeyCode::Char($($ch)*), code: ::helix_view::keyboard::KeyCode::Char($($ch)*),
modifiers: helix_view::keyboard::KeyModifiers::CONTROL, modifiers: ::helix_view::keyboard::KeyModifiers::CONTROL,
} }
}; };
} }
@ -129,8 +129,8 @@ macro_rules! ctrl {
macro_rules! alt { macro_rules! alt {
($($ch:tt)*) => { ($($ch:tt)*) => {
KeyEvent { KeyEvent {
code: helix_view::keyboard::KeyCode::Char($($ch)*), code: ::helix_view::keyboard::KeyCode::Char($($ch)*),
modifiers: helix_view::keyboard::KeyModifiers::ALT, modifiers: ::helix_view::keyboard::KeyModifiers::ALT,
} }
}; };
} }

Loading…
Cancel
Save