@ -20,7 +20,7 @@ macro_rules! shortcut_key_values {
(
$cname :expr ,
$( #[ $outer:meta ] ) *
pub struct $name :ident { $( $fname :ident : Key | > $fdesc : expr) , * } ) = > {
pub struct $name :ident { $( $fname :ident : Key | > $fdesc :literal | > $default : expr) , * } ) = > {
$( #[ $outer ] ) *
#[ derive(Debug, Clone, Serialize, Deserialize) ]
#[ serde(default) ]
@ -44,89 +44,56 @@ macro_rules! shortcut_key_values {
] . iter ( ) . cloned ( ) . collect ( )
}
}
impl Default for $name {
fn default ( ) -> Self {
Self {
$( $fname : $default ) , *
}
}
}
}
}
shortcut_key_values ! { "compact_listing" ,
/// Shortcut listing for a mail listing in compact mode.
pub struct CompactListingShortcuts {
open_thread : Key | > "Open thread." ,
exit_thread : Key | > "Exit thread view." ,
set_seen : Key | > "Set thread as seen."
}
}
impl Default for CompactListingShortcuts {
fn default ( ) -> Self {
CompactListingShortcuts {
open_thread : Key ::Char ( '\n' ) ,
exit_thread : Key ::Char ( 'i' ) ,
set_seen : Key ::Char ( 'n' ) ,
}
open_thread : Key | > "Open thread." | > Key ::Char ( '\n' ) ,
exit_thread : Key | > "Exit thread view." | > Key ::Char ( 'i' ) ,
select_entry : Key | > "Select thread entry." | > Key ::Char ( 'v' )
}
}
shortcut_key_values ! { "listing" ,
/// Shortcut listing for a mail listing.
pub struct ListingShortcuts {
prev_page : Key | > "Go to previous page." ,
next_page : Key | > "Go to next page." ,
prev_folder : Key | > "Go to previous folder." ,
next_folder : Key | > "Go to next folder." ,
prev_account : Key | > "Go to previous account." ,
next_account : Key | > "Go to next account." ,
new_mail : Key | > "Start new mail draft in new tab."
}
}
impl Default for ListingShortcuts {
fn default ( ) -> Self {
ListingShortcuts {
prev_page : Key ::PageUp ,
next_page : Key ::PageDown ,
prev_folder : Key ::Char ( 'K' ) ,
next_folder : Key ::Char ( 'J' ) ,
prev_account : Key ::Char ( 'l' ) ,
next_account : Key ::Char ( 'h' ) ,
new_mail : Key ::Char ( 'm' ) ,
}
prev_page : Key | > "Go to previous page." | > Key ::PageUp ,
next_page : Key | > "Go to next page." | > Key ::PageDown ,
prev_folder : Key | > "Go to previous folder." | > Key ::Char ( 'K' ) ,
next_folder : Key | > "Go to next folder." | > Key ::Char ( 'J' ) ,
prev_account : Key | > "Go to previous account." | > Key ::Char ( 'l' ) ,
next_account : Key | > "Go to next account." | > Key ::Char ( 'h' ) ,
new_mail : Key | > "Start new mail draft in new tab." | > Key ::Char ( 'm' ) ,
set_seen : Key | > "Set thread as seen." | > Key ::Char ( 'n' ) ,
search : Key | > "Search within list of e-mails." | > Key ::Char ( '/' ) ,
toggle_menu_visibility : Key | > "Toggle visibility of side menu in mail list." | > Key ::Char ( '`' )
}
}
shortcut_key_values ! { "contact-list" ,
/// Shortcut listing for the contact list view
pub struct ContactListShortcuts {
create_contact : Key | > "Create new contact." ,
edit_contact : Key | > "Edit contact under cursor."
}
}
impl Default for ContactListShortcuts {
fn default ( ) -> Self {
ContactListShortcuts {
create_contact : Key ::Char ( 'c' ) ,
edit_contact : Key ::Char ( 'e' ) ,
}
/// Shortcut listing for the contact list view
pub struct ContactListShortcuts {
create_contact : Key | > "Create new contact." | > Key ::Char ( 'c' ) ,
edit_contact : Key | > "Edit contact under cursor." | > Key ::Char ( 'e' )
}
}
shortcut_key_values ! { "pager" ,
/// Shortcut listing for the text pager
pub struct PagerShortcuts {
scroll_up : Key | > "Scroll up pager." ,
scroll_down : Key | > "Scroll down pager." ,
page_up : Key | > "Go to previous pager page" ,
page_down : Key | > "Go to next pager page"
}
}
impl Default for PagerShortcuts {
fn default ( ) -> Self {
PagerShortcuts {
scroll_up : Key ::Char ( 'k' ) ,
scroll_down : Key ::Char ( 'j' ) ,
page_up : Key ::PageUp ,
page_down : Key ::PageDown ,
}
/// Shortcut listing for the text pager
pub struct PagerShortcuts {
scroll_up : Key | > "Scroll up pager." | > Key ::Char ( 'k' ) ,
scroll_down : Key | > "Scroll down pager." | > Key ::Char ( 'j' ) ,
page_up : Key | > "Go to previous pager page" | > Key ::PageUp ,
page_down : Key | > "Go to next pager page" | > Key ::PageDown
}
}