shortcut!: prevent panic if shortcut key $section is missing
parent
f6d5c968ea
commit
315af9bc05
|
@ -27,9 +27,9 @@ use melib::{MeliError, Result};
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! shortcut {
|
macro_rules! shortcut {
|
||||||
($key:ident == $shortcuts:ident[$section:expr][$val:literal]) => {
|
($key:ident == $shortcuts:ident[$section:expr][$val:literal]) => {
|
||||||
$shortcuts[$section]
|
$shortcuts
|
||||||
.get($val)
|
.get($section)
|
||||||
.map(|v| v == $key)
|
.and_then(|s| s.get($val).map(|v| v == $key))
|
||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue