Fix compact listing defaults

embed
Manos Pitsidianakis 2019-03-03 23:48:13 +02:00
parent 5e306130fb
commit 1f200cfc88
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
1 changed files with 6 additions and 17 deletions

View File

@ -4,9 +4,10 @@ use fnv::FnvHashMap;
#[macro_export] #[macro_export]
macro_rules! key_values { macro_rules! key_values {
(derive ($($derives:ident),*) : pub struct $name:ident { $($fname:ident : Key),* }) => { ( $cname:expr, derive ($($derives:ident),*) : pub struct $name:ident { $($fname:ident : Key),* }) => {
#[derive($($derives),*)] #[derive($($derives),*)]
#[serde(default)] #[serde(default)]
#[serde(rename = $cname)]
pub struct $name { pub struct $name {
$($fname : Key),* $($fname : Key),*
} }
@ -21,7 +22,7 @@ macro_rules! key_values {
} }
} }
key_values!{derive (Debug, Clone, Deserialize) : key_values!{ "compact-listing", derive (Debug, Clone, Deserialize) :
pub struct CompactListingShortcuts { pub struct CompactListingShortcuts {
open_thread: Key, open_thread: Key,
exit_thread: Key, exit_thread: Key,
@ -40,9 +41,9 @@ impl Default for CompactListingShortcuts {
fn default() -> Self { fn default() -> Self {
CompactListingShortcuts { CompactListingShortcuts {
open_thread: Key::Char('\n'), open_thread: Key::Char('\n'),
exit_thread: Key::PageUp, exit_thread: Key::Char('i'),
prev_page: Key::PageDown, prev_page: Key::PageUp,
next_page: Key::Char('i'), next_page: Key::PageDown,
prev_folder: Key::Char('J'), prev_folder: Key::Char('J'),
next_folder: Key::Char('K'), next_folder: Key::Char('K'),
prev_account:Key::Char('h'), prev_account:Key::Char('h'),
@ -51,15 +52,3 @@ impl Default for CompactListingShortcuts {
} }
} }
} }
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_macro() {
panic!()
}
}