conf/shortcuts.rs: replace use of Self::DESCRIPTION with Shortcuts struct consts

pull/169/head
Manos Pitsidianakis 1 year ago
parent 7d9cabb023
commit 7af893597f

@ -684,6 +684,31 @@ Generic scroll up (catch-all setting)
Generic scroll down (catch-all setting)
.\" default value
.Pq Em j
.It Ic next_page
Go to next page.
(catch-all setting)
.\" default value
.Pq Em PageDown
.It Ic prev_page
Go to previous page.
(catch-all setting)
.\" default value
.Pq Em PageUp
.It Ic home_page
Go to first page.
(catch-all setting)
.\" default value
.Pq Em Home
.It Ic end_page
Go to last page.
(catch-all setting)
.\" default value
.Pq Em End
.It Ic open_entry
Open list entry.
(catch-all setting)
.\" default value
.Pq Em Enter
.It Ic info_message_next
Show next info message, if any
.\" default value

@ -69,12 +69,11 @@ pub struct ContactList {
impl fmt::Display for ContactList {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", ContactList::DESCRIPTION)
write!(f, "{}", "contact list")
}
}
impl ContactList {
const DESCRIPTION: &'static str = "contact list";
pub fn new(context: &Context) -> Self {
let accounts = context
.accounts
@ -636,7 +635,7 @@ impl Component for ContactList {
if self.view.is_none() {
match *event {
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Self::DESCRIPTION]["create_contact"]) =>
if shortcut!(key == shortcuts[Shortcuts::CONTACT_LIST]["create_contact"]) =>
{
let mut manager = ContactManager::new(context);
manager.set_parent_id(self.id);
@ -654,7 +653,7 @@ impl Component for ContactList {
}
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Self::DESCRIPTION]["edit_contact"])
if shortcut!(key == shortcuts[Shortcuts::CONTACT_LIST]["edit_contact"])
&& self.length > 0 =>
{
let account = &mut context.accounts[self.account_pos];
@ -676,7 +675,7 @@ impl Component for ContactList {
return true;
}
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Self::DESCRIPTION]["mail_contact"])
if shortcut!(key == shortcuts[Shortcuts::CONTACT_LIST]["mail_contact"])
&& self.length > 0 =>
{
let account = &context.accounts[self.account_pos];
@ -695,7 +694,7 @@ impl Component for ContactList {
return true;
}
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Self::DESCRIPTION]["next_account"]) =>
if shortcut!(key == shortcuts[Shortcuts::CONTACT_LIST]["next_account"]) =>
{
let amount = if self.cmd_buf.is_empty() {
1
@ -732,7 +731,7 @@ impl Component for ContactList {
return true;
}
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Self::DESCRIPTION]["prev_account"]) =>
if shortcut!(key == shortcuts[Shortcuts::CONTACT_LIST]["prev_account"]) =>
{
let amount = if self.cmd_buf.is_empty() {
1
@ -768,7 +767,9 @@ impl Component for ContactList {
return true;
}
UIEvent::Input(ref k)
if shortcut!(k == shortcuts[Self::DESCRIPTION]["toggle_menu_visibility"]) =>
if shortcut!(
k == shortcuts[Shortcuts::CONTACT_LIST]["toggle_menu_visibility"]
) =>
{
self.menu_visibility = !self.menu_visibility;
self.set_dirty(true);
@ -792,7 +793,7 @@ impl Component for ContactList {
return true;
}
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Self::DESCRIPTION]["scroll_up"]) =>
if shortcut!(key == shortcuts[Shortcuts::CONTACT_LIST]["scroll_up"]) =>
{
let amount = if self.cmd_buf.is_empty() {
1
@ -814,7 +815,7 @@ impl Component for ContactList {
return true;
}
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Self::DESCRIPTION]["scroll_down"])
if shortcut!(key == shortcuts[Shortcuts::CONTACT_LIST]["scroll_down"])
&& self.cursor_pos < self.length.saturating_sub(1) =>
{
let amount = if self.cmd_buf.is_empty() {
@ -836,7 +837,9 @@ impl Component for ContactList {
self.movement = Some(PageMovement::Down(amount));
return true;
}
UIEvent::Input(Key::PageUp) => {
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Shortcuts::GENERAL]["prev_page"]) =>
{
let mult = if self.cmd_buf.is_empty() {
1
} else if let Ok(mult) = self.cmd_buf.parse::<usize>() {
@ -856,7 +859,9 @@ impl Component for ContactList {
self.movement = Some(PageMovement::PageUp(mult));
return true;
}
UIEvent::Input(Key::PageDown) => {
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Shortcuts::GENERAL]["next_page"]) =>
{
let mult = if self.cmd_buf.is_empty() {
1
} else if let Ok(mult) = self.cmd_buf.parse::<usize>() {
@ -876,12 +881,16 @@ impl Component for ContactList {
self.movement = Some(PageMovement::PageDown(mult));
return true;
}
UIEvent::Input(ref key) if *key == Key::Home => {
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Shortcuts::GENERAL]["home_page"]) =>
{
self.set_dirty(true);
self.movement = Some(PageMovement::Home);
return true;
}
UIEvent::Input(ref key) if *key == Key::End => {
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Shortcuts::GENERAL]["end_page"]) =>
{
self.set_dirty(true);
self.movement = Some(PageMovement::End);
return true;
@ -930,8 +939,14 @@ impl Component for ContactList {
.map(|p| p.get_shortcuts(context))
.unwrap_or_default();
let config_map = context.settings.shortcuts.contact_list.key_values();
map.insert(Self::DESCRIPTION, config_map);
map.insert(
Shortcuts::CONTACT_LIST,
context.settings.shortcuts.contact_list.key_values(),
);
map.insert(
Shortcuts::GENERAL,
context.settings.shortcuts.general.key_values(),
);
map
}

@ -145,7 +145,6 @@ impl fmt::Display for Composer {
}
impl Composer {
const DESCRIPTION: &'static str = "composing";
pub fn new(context: &Context) -> Self {
let mut pager = Pager::new(context);
pager.set_show_scrollbar(true);
@ -906,12 +905,12 @@ impl Component for Composer {
account_settings!(context[self.account_hash].shortcuts.composing)
.key_values();
let mut shortcuts: ShortcutMaps = Default::default();
shortcuts.insert(Composer::DESCRIPTION, our_map);
shortcuts.insert(Shortcuts::COMPOSING, our_map);
let stopped_message: String =
format!("Process with PID {} has stopped.", guard.child_pid);
let stopped_message_2: String = format!(
"-press '{}' (edit_mail shortcut) to re-activate.",
shortcuts[Self::DESCRIPTION]["edit_mail"]
shortcuts[Shortcuts::COMPOSING]["edit_mail"]
);
const STOPPED_MESSAGE_3: &str =
"-press Ctrl-C to forcefully kill it and return to editor.";
@ -1349,7 +1348,7 @@ impl Component for Composer {
}*/
UIEvent::Input(ref key)
if self.mode.is_edit()
&& shortcut!(key == shortcuts[Self::DESCRIPTION]["scroll_up"]) =>
&& shortcut!(key == shortcuts[Shortcuts::COMPOSING]["scroll_up"]) =>
{
self.cursor = match self.cursor {
Cursor::Headers => return true,
@ -1365,7 +1364,7 @@ impl Component for Composer {
}
UIEvent::Input(ref key)
if self.mode.is_edit()
&& shortcut!(key == shortcuts[Self::DESCRIPTION]["scroll_down"]) =>
&& shortcut!(key == shortcuts[Shortcuts::COMPOSING]["scroll_down"]) =>
{
self.cursor = match self.cursor {
Cursor::Headers => Cursor::Body,
@ -1395,7 +1394,7 @@ impl Component for Composer {
self.dirty = true;
}
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Self::DESCRIPTION]["send_mail"])
if shortcut!(key == shortcuts[Shortcuts::COMPOSING]["send_mail"])
&& self.mode.is_edit() =>
{
self.update_draft();
@ -1535,7 +1534,7 @@ impl Component for Composer {
UIEvent::Input(ref key)
if self.mode.is_edit()
&& self.cursor == Cursor::Sign
&& shortcut!(key == shortcuts[Self::DESCRIPTION]["edit_mail"]) =>
&& shortcut!(key == shortcuts[Shortcuts::COMPOSING]["edit_mail"]) =>
{
#[cfg(feature = "gpgme")]
match melib::email::parser::address::rfc2822address_list(
@ -1575,7 +1574,7 @@ impl Component for Composer {
UIEvent::Input(ref key)
if self.mode.is_edit()
&& self.cursor == Cursor::Encrypt
&& shortcut!(key == shortcuts[Self::DESCRIPTION]["edit_mail"]) =>
&& shortcut!(key == shortcuts[Shortcuts::COMPOSING]["edit_mail"]) =>
{
#[cfg(feature = "gpgme")]
match melib::email::parser::address::rfc2822address_list(
@ -1615,7 +1614,7 @@ impl Component for Composer {
UIEvent::Input(ref key)
if self.mode.is_edit()
&& self.cursor == Cursor::Attachments
&& shortcut!(key == shortcuts[Self::DESCRIPTION]["edit_mail"]) =>
&& shortcut!(key == shortcuts[Shortcuts::COMPOSING]["edit_mail"]) =>
{
self.mode = ViewMode::EditAttachments {
widget: EditAttachments::new(),
@ -1626,7 +1625,7 @@ impl Component for Composer {
}
UIEvent::Input(ref key)
if self.embed.is_some()
&& shortcut!(key == shortcuts[Self::DESCRIPTION]["edit_mail"]) =>
&& shortcut!(key == shortcuts[Shortcuts::COMPOSING]["edit_mail"]) =>
{
self.embed.as_ref().unwrap().lock().unwrap().wake_up();
match self.embed.take() {
@ -1670,7 +1669,7 @@ impl Component for Composer {
}
UIEvent::Input(ref key)
if self.mode.is_edit()
&& shortcut!(key == shortcuts[Self::DESCRIPTION]["edit_mail"]) =>
&& shortcut!(key == shortcuts[Shortcuts::COMPOSING]["edit_mail"]) =>
{
/* Edit draft in $EDITOR */
let editor = if let Some(editor_command) =
@ -2061,7 +2060,7 @@ impl Component for Composer {
let our_map: ShortcutMap =
account_settings!(context[self.account_hash].shortcuts.composing).key_values();
map.insert(Composer::DESCRIPTION, our_map);
map.insert(Shortcuts::COMPOSING, our_map);
map
}

@ -1115,7 +1115,7 @@ impl Component for Listing {
}
UIEvent::Input(ref k)
if self.is_menu_visible()
&& shortcut!(k == shortcuts[Listing::DESCRIPTION]["focus_left"]) =>
&& shortcut!(k == shortcuts[Shortcuts::LISTING]["focus_left"]) =>
{
self.focus = ListingFocus::Menu;
if self.show_menu_scrollbar != ShowMenuScrollbar::Never {
@ -1127,8 +1127,8 @@ impl Component for Listing {
self.set_dirty(true);
}
UIEvent::Input(ref k)
if shortcut!(k == shortcuts[Listing::DESCRIPTION]["next_mailbox"])
|| shortcut!(k == shortcuts[Listing::DESCRIPTION]["prev_mailbox"]) =>
if shortcut!(k == shortcuts[Shortcuts::LISTING]["next_mailbox"])
|| shortcut!(k == shortcuts[Shortcuts::LISTING]["prev_mailbox"]) =>
{
let amount = if self.cmd_buf.is_empty() {
1
@ -1148,13 +1148,13 @@ impl Component for Listing {
return true;
};
let target = match k {
k if shortcut!(k == shortcuts[Listing::DESCRIPTION]["next_mailbox"]) => {
k if shortcut!(k == shortcuts[Shortcuts::LISTING]["next_mailbox"]) => {
match self.cursor_pos.1 {
MenuEntryCursor::Status => amount.saturating_sub(1),
MenuEntryCursor::Mailbox(idx) => idx + amount,
}
}
k if shortcut!(k == shortcuts[Listing::DESCRIPTION]["prev_mailbox"]) => {
k if shortcut!(k == shortcuts[Shortcuts::LISTING]["prev_mailbox"]) => {
match self.cursor_pos.1 {
MenuEntryCursor::Status => {
return true;
@ -1183,8 +1183,8 @@ impl Component for Listing {
return true;
}
UIEvent::Input(ref k)
if shortcut!(k == shortcuts[Listing::DESCRIPTION]["next_account"])
|| shortcut!(k == shortcuts[Listing::DESCRIPTION]["prev_account"]) =>
if shortcut!(k == shortcuts[Shortcuts::LISTING]["next_account"])
|| shortcut!(k == shortcuts[Shortcuts::LISTING]["prev_account"]) =>
{
let amount = if self.cmd_buf.is_empty() {
1
@ -1204,7 +1204,7 @@ impl Component for Listing {
return true;
};
match k {
k if shortcut!(k == shortcuts[Listing::DESCRIPTION]["next_account"]) => {
k if shortcut!(k == shortcuts[Shortcuts::LISTING]["next_account"]) => {
if self.cursor_pos.0 + amount < self.accounts.len() {
self.cursor_pos =
(self.cursor_pos.0 + amount, MenuEntryCursor::Mailbox(0));
@ -1212,7 +1212,7 @@ impl Component for Listing {
return true;
}
}
k if shortcut!(k == shortcuts[Listing::DESCRIPTION]["prev_account"]) => {
k if shortcut!(k == shortcuts[Shortcuts::LISTING]["prev_account"]) => {
if self.cursor_pos.0 >= amount {
self.cursor_pos =
(self.cursor_pos.0 - amount, MenuEntryCursor::Mailbox(0));
@ -1227,15 +1227,13 @@ impl Component for Listing {
return true;
}
UIEvent::Input(ref k)
if shortcut!(
k == shortcuts[Listing::DESCRIPTION]["toggle_menu_visibility"]
) =>
if shortcut!(k == shortcuts[Shortcuts::LISTING]["toggle_menu_visibility"]) =>
{
self.menu_visibility = !self.menu_visibility;
self.set_dirty(true);
}
UIEvent::Input(ref k)
if shortcut!(k == shortcuts[Listing::DESCRIPTION]["increase_sidebar"]) =>
if shortcut!(k == shortcuts[Shortcuts::LISTING]["increase_sidebar"]) =>
{
self.ratio = self.ratio.saturating_sub(2);
self.prev_ratio = self.prev_ratio.saturating_sub(2);
@ -1243,7 +1241,7 @@ impl Component for Listing {
self.set_dirty(true);
}
UIEvent::Input(ref k)
if shortcut!(k == shortcuts[Listing::DESCRIPTION]["decrease_sidebar"]) =>
if shortcut!(k == shortcuts[Shortcuts::LISTING]["decrease_sidebar"]) =>
{
self.ratio += 2;
self.ratio = std::cmp::min(100, self.ratio);
@ -1319,7 +1317,7 @@ impl Component for Listing {
_ => {}
},
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Listing::DESCRIPTION]["scroll_up"]) =>
if shortcut!(key == shortcuts[Shortcuts::LISTING]["scroll_up"]) =>
{
let amount = if self.cmd_buf.is_empty() {
1
@ -1342,7 +1340,7 @@ impl Component for Listing {
return true;
}
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Listing::DESCRIPTION]["scroll_down"]) =>
if shortcut!(key == shortcuts[Shortcuts::LISTING]["scroll_down"]) =>
{
let amount = if self.cmd_buf.is_empty() {
1
@ -1365,7 +1363,7 @@ impl Component for Listing {
return true;
}
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Listing::DESCRIPTION]["prev_page"]) =>
if shortcut!(key == shortcuts[Shortcuts::LISTING]["prev_page"]) =>
{
let mult = if self.cmd_buf.is_empty() {
1
@ -1388,7 +1386,7 @@ impl Component for Listing {
return true;
}
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Listing::DESCRIPTION]["next_page"]) =>
if shortcut!(key == shortcuts[Shortcuts::LISTING]["next_page"]) =>
{
let mult = if self.cmd_buf.is_empty() {
1
@ -1419,7 +1417,7 @@ impl Component for Listing {
return true;
}
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Listing::DESCRIPTION]["search"]) =>
if shortcut!(key == shortcuts[Shortcuts::LISTING]["search"]) =>
{
context
.replies
@ -1430,7 +1428,7 @@ impl Component for Listing {
return true;
}
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Listing::DESCRIPTION]["set_seen"]) =>
if shortcut!(key == shortcuts[Shortcuts::LISTING]["set_seen"]) =>
{
let mut event = UIEvent::Action(Action::Listing(ListingAction::SetSeen));
if self.process_event(&mut event, context) {
@ -1438,7 +1436,7 @@ impl Component for Listing {
}
}
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Listing::DESCRIPTION]["refresh"]) =>
if shortcut!(key == shortcuts[Shortcuts::LISTING]["refresh"]) =>
{
let account = &mut context.accounts[self.cursor_pos.0];
if let MenuEntryCursor::Mailbox(idx) = self.cursor_pos.1 {
@ -1457,7 +1455,7 @@ impl Component for Listing {
UIEvent::Input(ref key)
if !self.component.unfocused()
&& shortcut!(
key == shortcuts[Listing::DESCRIPTION]["union_modifier"]
key == shortcuts[Shortcuts::LISTING]["union_modifier"]
)
&& self.component.modifier_command().is_some() =>
{
@ -1465,9 +1463,7 @@ impl Component for Listing {
}
UIEvent::Input(ref key)
if !self.component.unfocused()
&& shortcut!(
key == shortcuts[Listing::DESCRIPTION]["diff_modifier"]
)
&& shortcut!(key == shortcuts[Shortcuts::LISTING]["diff_modifier"])
&& self.component.modifier_command().is_some() =>
{
self.component
@ -1476,7 +1472,7 @@ impl Component for Listing {
UIEvent::Input(ref key)
if !self.component.unfocused()
&& shortcut!(
key == shortcuts[Listing::DESCRIPTION]["intersection_modifier"]
key == shortcuts[Shortcuts::LISTING]["intersection_modifier"]
)
&& self.component.modifier_command().is_some() =>
{
@ -1489,7 +1485,7 @@ impl Component for Listing {
} else if self.focus == ListingFocus::Menu {
match *event {
UIEvent::Input(ref k)
if shortcut!(k == shortcuts[Listing::DESCRIPTION]["focus_right"]) =>
if shortcut!(k == shortcuts[Shortcuts::LISTING]["focus_right"]) =>
{
self.focus = ListingFocus::Mailbox;
context
@ -1502,7 +1498,7 @@ impl Component for Listing {
return true;
}
UIEvent::Input(ref k)
if shortcut!(k == shortcuts[Listing::DESCRIPTION]["open_mailbox"])
if shortcut!(k == shortcuts[Shortcuts::LISTING]["open_mailbox"])
&& self.menu_cursor_pos.1 == MenuEntryCursor::Status =>
{
self.cursor_pos = self.menu_cursor_pos;
@ -1518,9 +1514,8 @@ impl Component for Listing {
return true;
}
UIEvent::Input(ref k)
if shortcut!(
k == shortcuts[Listing::DESCRIPTION]["toggle_mailbox_collapse"]
) && matches!(self.menu_cursor_pos.1, MenuEntryCursor::Mailbox(_)) =>
if shortcut!(k == shortcuts[Shortcuts::LISTING]["toggle_mailbox_collapse"])
&& matches!(self.menu_cursor_pos.1, MenuEntryCursor::Mailbox(_)) =>
{
let target_mailbox_idx =
if let MenuEntryCursor::Mailbox(idx) = self.menu_cursor_pos.1 {
@ -1545,7 +1540,7 @@ impl Component for Listing {
return false;
}
UIEvent::Input(ref k)
if shortcut!(k == shortcuts[Listing::DESCRIPTION]["open_mailbox"]) =>
if shortcut!(k == shortcuts[Shortcuts::LISTING]["open_mailbox"]) =>
{
self.cursor_pos = self.menu_cursor_pos;
self.change_account(context);
@ -1565,8 +1560,8 @@ impl Component for Listing {
return true;
}
UIEvent::Input(ref k)
if shortcut!(k == shortcuts[Listing::DESCRIPTION]["scroll_up"])
|| shortcut!(k == shortcuts[Listing::DESCRIPTION]["scroll_down"]) =>
if shortcut!(k == shortcuts[Shortcuts::LISTING]["scroll_up"])
|| shortcut!(k == shortcuts[Shortcuts::LISTING]["scroll_down"]) =>
{
let mut amount = if self.cmd_buf.is_empty() {
1
@ -1585,7 +1580,7 @@ impl Component for Listing {
.push_back(UIEvent::StatusEvent(StatusEvent::BufClear));
return true;
};
if shortcut!(k == shortcuts[Listing::DESCRIPTION]["scroll_up"]) {
if shortcut!(k == shortcuts[Shortcuts::LISTING]["scroll_up"]) {
while amount > 0 {
match self.menu_cursor_pos {
(
@ -1624,7 +1619,7 @@ impl Component for Listing {
amount -= 1;
}
} else if shortcut!(k == shortcuts[Listing::DESCRIPTION]["scroll_down"]) {
} else if shortcut!(k == shortcuts[Shortcuts::LISTING]["scroll_down"]) {
while amount > 0 {
match self.menu_cursor_pos {
/* If current account has mailboxes, go to first mailbox */
@ -1681,8 +1676,8 @@ impl Component for Listing {
return true;
}
UIEvent::Input(ref k)
if shortcut!(k == shortcuts[Listing::DESCRIPTION]["next_mailbox"])
|| shortcut!(k == shortcuts[Listing::DESCRIPTION]["prev_mailbox"]) =>
if shortcut!(k == shortcuts[Shortcuts::LISTING]["next_mailbox"])
|| shortcut!(k == shortcuts[Shortcuts::LISTING]["prev_mailbox"]) =>
{
let amount = if self.cmd_buf.is_empty() {
1
@ -1702,13 +1697,13 @@ impl Component for Listing {
return true;
};
let target = match k {
k if shortcut!(k == shortcuts[Listing::DESCRIPTION]["next_mailbox"]) => {
k if shortcut!(k == shortcuts[Shortcuts::LISTING]["next_mailbox"]) => {
match self.menu_cursor_pos.1 {
MenuEntryCursor::Status => amount.saturating_sub(1),
MenuEntryCursor::Mailbox(idx) => idx + amount,
}
}
k if shortcut!(k == shortcuts[Listing::DESCRIPTION]["prev_mailbox"]) => {
k if shortcut!(k == shortcuts[Shortcuts::LISTING]["prev_mailbox"]) => {
match self.menu_cursor_pos.1 {
MenuEntryCursor::Status => {
return true;
@ -1741,10 +1736,10 @@ impl Component for Listing {
return true;
}
UIEvent::Input(ref k)
if shortcut!(k == shortcuts[Listing::DESCRIPTION]["next_account"])
|| shortcut!(k == shortcuts[Listing::DESCRIPTION]["prev_account"])
|| shortcut!(k == shortcuts[Listing::DESCRIPTION]["next_page"])
|| shortcut!(k == shortcuts[Listing::DESCRIPTION]["prev_page"]) =>
if shortcut!(k == shortcuts[Shortcuts::LISTING]["next_account"])
|| shortcut!(k == shortcuts[Shortcuts::LISTING]["prev_account"])
|| shortcut!(k == shortcuts[Shortcuts::LISTING]["next_page"])
|| shortcut!(k == shortcuts[Shortcuts::LISTING]["prev_page"]) =>
{
let amount = if self.cmd_buf.is_empty() {
1
@ -1764,8 +1759,8 @@ impl Component for Listing {
return true;
};
match k {
k if shortcut!(k == shortcuts[Listing::DESCRIPTION]["next_account"])
|| shortcut!(k == shortcuts[Listing::DESCRIPTION]["next_page"]) =>
k if shortcut!(k == shortcuts[Shortcuts::LISTING]["next_account"])
|| shortcut!(k == shortcuts[Shortcuts::LISTING]["next_page"]) =>
{
if self.menu_cursor_pos.0 + amount < self.accounts.len() {
self.menu_cursor_pos =
@ -1774,8 +1769,8 @@ impl Component for Listing {
return true;
}
}
k if shortcut!(k == shortcuts[Listing::DESCRIPTION]["prev_account"])
|| shortcut!(k == shortcuts[Listing::DESCRIPTION]["prev_page"]) =>
k if shortcut!(k == shortcuts[Shortcuts::LISTING]["prev_account"])
|| shortcut!(k == shortcuts[Shortcuts::LISTING]["prev_page"]) =>
{
if self.menu_cursor_pos.0 >= amount {
self.menu_cursor_pos =
@ -1799,9 +1794,7 @@ impl Component for Listing {
}
}
match *event {
UIEvent::Input(ref k)
if shortcut!(k == shortcuts[Listing::DESCRIPTION]["new_mail"]) =>
{
UIEvent::Input(ref k) if shortcut!(k == shortcuts[Shortcuts::LISTING]["new_mail"]) => {
let account_hash = context.accounts[self.cursor_pos.0].hash();
let composer = Composer::with_account(account_hash, context);
context
@ -1889,7 +1882,7 @@ impl Component for Listing {
if self.focus != ListingFocus::Menu {
config_map.remove("open_mailbox");
}
map.insert(Listing::DESCRIPTION, config_map);
map.insert(Shortcuts::LISTING, config_map);
map
}
@ -1944,7 +1937,6 @@ impl Component for Listing {
}
impl Listing {
pub const DESCRIPTION: &'static str = "listing";
pub fn new(context: &mut Context) -> Self {
let account_entries: Vec<AccountMenuEntry> = context
.accounts

@ -1586,19 +1586,19 @@ impl Component for CompactListing {
match (&event, self.focus) {
(UIEvent::Input(ref k), Focus::Entry)
if shortcut!(k == shortcuts[Listing::DESCRIPTION]["focus_right"]) =>
if shortcut!(k == shortcuts[Shortcuts::LISTING]["focus_right"]) =>
{
self.set_focus(Focus::EntryFullscreen, context);
return true;
}
(UIEvent::Input(ref k), Focus::EntryFullscreen)
if shortcut!(k == shortcuts[Listing::DESCRIPTION]["focus_left"]) =>
if shortcut!(k == shortcuts[Shortcuts::LISTING]["focus_left"]) =>
{
self.set_focus(Focus::Entry, context);
return true;
}
(UIEvent::Input(ref k), Focus::Entry)
if shortcut!(k == shortcuts[Listing::DESCRIPTION]["focus_left"]) =>
if shortcut!(k == shortcuts[Shortcuts::LISTING]["focus_left"]) =>
{
self.set_focus(Focus::None, context);
return true;
@ -1614,8 +1614,8 @@ impl Component for CompactListing {
match *event {
UIEvent::Input(ref k)
if matches!(self.focus, Focus::None)
&& (shortcut!(k == shortcuts[Listing::DESCRIPTION]["open_entry"])
|| shortcut!(k == shortcuts[Listing::DESCRIPTION]["focus_right"])) =>
&& (shortcut!(k == shortcuts[Shortcuts::LISTING]["open_entry"])
|| shortcut!(k == shortcuts[Shortcuts::LISTING]["focus_right"])) =>
{
if let Some(thread) = self.get_thread_under_cursor(self.cursor_pos.2) {
self.view =
@ -1626,21 +1626,21 @@ impl Component for CompactListing {
}
UIEvent::Input(ref k)
if matches!(self.focus, Focus::Entry)
&& shortcut!(k == shortcuts[Listing::DESCRIPTION]["exit_entry"]) =>
&& shortcut!(k == shortcuts[Shortcuts::LISTING]["exit_entry"]) =>
{
self.set_focus(Focus::None, context);
return true;
}
UIEvent::Input(ref k)
if matches!(self.focus, Focus::None)
&& shortcut!(k == shortcuts[Listing::DESCRIPTION]["focus_right"]) =>
&& shortcut!(k == shortcuts[Shortcuts::LISTING]["focus_right"]) =>
{
self.set_focus(Focus::Entry, context);
return true;
}
UIEvent::Input(ref k)
if !matches!(self.focus, Focus::None)
&& shortcut!(k == shortcuts[Listing::DESCRIPTION]["focus_left"]) =>
&& shortcut!(k == shortcuts[Shortcuts::LISTING]["focus_left"]) =>
{
match self.focus {
Focus::Entry => {
@ -1657,7 +1657,7 @@ impl Component for CompactListing {
}
UIEvent::Input(ref key)
if !self.unfocused()
&& shortcut!(key == shortcuts[Listing::DESCRIPTION]["select_entry"]) =>
&& shortcut!(key == shortcuts[Shortcuts::LISTING]["select_entry"]) =>
{
if self.modifier_active && self.modifier_command.is_none() {
self.modifier_command = Some(Modifier::default());
@ -1951,8 +1951,10 @@ impl Component for CompactListing {
ShortcutMaps::default()
};
let config_map = context.settings.shortcuts.listing.key_values();
map.insert(Listing::DESCRIPTION, config_map);
map.insert(
Shortcuts::LISTING,
context.settings.shortcuts.listing.key_values(),
);
map
}

@ -611,7 +611,6 @@ impl fmt::Display for ConversationsListing {
}
impl ConversationsListing {
//const DESCRIPTION: &'static str = "conversations listing";
//const PADDING_CHAR: char = ' '; //░';
pub fn new(coordinates: (AccountHash, MailboxHash)) -> Box<Self> {
@ -1230,19 +1229,19 @@ impl Component for ConversationsListing {
match (&event, self.focus) {
(UIEvent::Input(ref k), Focus::Entry)
if shortcut!(k == shortcuts[Listing::DESCRIPTION]["focus_right"]) =>
if shortcut!(k == shortcuts[Shortcuts::LISTING]["focus_right"]) =>
{
self.set_focus(Focus::EntryFullscreen, context);
return true;
}
(UIEvent::Input(ref k), Focus::EntryFullscreen)
if shortcut!(k == shortcuts[Listing::DESCRIPTION]["focus_left"]) =>
if shortcut!(k == shortcuts[Shortcuts::LISTING]["focus_left"]) =>
{
self.set_focus(Focus::Entry, context);
return true;
}
(UIEvent::Input(ref k), Focus::Entry)
if shortcut!(k == shortcuts[Listing::DESCRIPTION]["focus_left"]) =>
if shortcut!(k == shortcuts[Shortcuts::LISTING]["focus_left"]) =>
{
self.set_focus(Focus::None, context);
return true;
@ -1258,8 +1257,8 @@ impl Component for ConversationsListing {
match *event {
UIEvent::Input(ref k)
if matches!(self.focus, Focus::None)
&& (shortcut!(k == shortcuts[Listing::DESCRIPTION]["open_entry"])
|| shortcut!(k == shortcuts[Listing::DESCRIPTION]["focus_right"])) =>
&& (shortcut!(k == shortcuts[Shortcuts::LISTING]["open_entry"])
|| shortcut!(k == shortcuts[Shortcuts::LISTING]["focus_right"])) =>
{
if let Some(thread) = self.get_thread_under_cursor(self.cursor_pos.2) {
self.view = ThreadView::new(self.cursor_pos, thread, None, context);
@ -1269,21 +1268,21 @@ impl Component for ConversationsListing {
}
UIEvent::Input(ref k)
if !matches!(self.focus, Focus::None)
&& shortcut!(k == shortcuts[Listing::DESCRIPTION]["exit_entry"]) =>
&& shortcut!(k == shortcuts[Shortcuts::LISTING]["exit_entry"]) =>
{
self.set_focus(Focus::None, context);
return true;
}
UIEvent::Input(ref k)
if matches!(self.focus, Focus::Entry)
&& shortcut!(k == shortcuts[Listing::DESCRIPTION]["focus_right"]) =>
&& shortcut!(k == shortcuts[Shortcuts::LISTING]["focus_right"]) =>
{
self.set_focus(Focus::EntryFullscreen, context);
return true;
}
UIEvent::Input(ref k)
if !matches!(self.focus, Focus::None)
&& shortcut!(k == shortcuts[Listing::DESCRIPTION]["focus_left"]) =>
&& shortcut!(k == shortcuts[Shortcuts::LISTING]["focus_left"]) =>
{
match self.focus {
Focus::Entry => {
@ -1300,7 +1299,7 @@ impl Component for ConversationsListing {
}
UIEvent::Input(ref key)
if !self.unfocused()
&& shortcut!(key == shortcuts[Listing::DESCRIPTION]["select_entry"]) =>
&& shortcut!(key == shortcuts[Shortcuts::LISTING]["select_entry"]) =>
{
if self.modifier_active && self.modifier_command.is_none() {
self.modifier_command = Some(Modifier::default());
@ -1560,8 +1559,10 @@ impl Component for ConversationsListing {
ShortcutMaps::default()
};
let config_map = context.settings.shortcuts.listing.key_values();
map.insert(Listing::DESCRIPTION, config_map);
map.insert(
Shortcuts::LISTING,
context.settings.shortcuts.listing.key_values(),
);
map
}

@ -621,7 +621,6 @@ impl fmt::Display for PlainListing {
}
impl PlainListing {
//const DESCRIPTION: &'static str = "plain listing";
pub fn new(coordinates: (AccountHash, MailboxHash)) -> Box<Self> {
Box::new(PlainListing {
cursor_pos: (0, 1, 0),
@ -1084,19 +1083,19 @@ impl Component for PlainListing {
match (&event, self.focus) {
(UIEvent::Input(ref k), Focus::Entry)
if shortcut!(k == shortcuts[Listing::DESCRIPTION]["focus_right"]) =>
if shortcut!(k == shortcuts[Shortcuts::LISTING]["focus_right"]) =>
{
self.set_focus(Focus::EntryFullscreen, context);
return true;
}
(UIEvent::Input(ref k), Focus::EntryFullscreen)
if shortcut!(k == shortcuts[Listing::DESCRIPTION]["focus_left"]) =>
if shortcut!(k == shortcuts[Shortcuts::LISTING]["focus_left"]) =>
{
self.set_focus(Focus::Entry, context);
return true;
}
(UIEvent::Input(ref k), Focus::Entry)
if shortcut!(k == shortcuts[Listing::DESCRIPTION]["focus_left"]) =>
if shortcut!(k == shortcuts[Shortcuts::LISTING]["focus_left"]) =>
{
self.set_focus(Focus::None, context);
return true;
@ -1112,22 +1111,22 @@ impl Component for PlainListing {
match *event {
UIEvent::Input(ref k)
if matches!(self.focus, Focus::None)
&& (shortcut!(k == shortcuts[Listing::DESCRIPTION]["open_entry"])
|| shortcut!(k == shortcuts[Listing::DESCRIPTION]["focus_right"])) =>
&& (shortcut!(k == shortcuts[Shortcuts::LISTING]["open_entry"])
|| shortcut!(k == shortcuts[Shortcuts::LISTING]["focus_right"])) =>
{
self.set_focus(Focus::Entry, context);
return true;
}
UIEvent::Input(ref k)
if !matches!(self.focus, Focus::None)
&& shortcut!(k == shortcuts[Listing::DESCRIPTION]["exit_entry"]) =>
&& shortcut!(k == shortcuts[Shortcuts::LISTING]["exit_entry"]) =>
{
self.set_focus(Focus::None, context);
return true;
}
UIEvent::Input(ref k)
if !matches!(self.focus, Focus::None)
&& shortcut!(k == shortcuts[Listing::DESCRIPTION]["focus_left"]) =>
&& shortcut!(k == shortcuts[Shortcuts::LISTING]["focus_left"]) =>
{
match self.focus {
Focus::Entry => {
@ -1144,7 +1143,7 @@ impl Component for PlainListing {
}
UIEvent::Input(ref key)
if !self.unfocused()
&& shortcut!(key == shortcuts[Listing::DESCRIPTION]["select_entry"]) =>
&& shortcut!(key == shortcuts[Shortcuts::LISTING]["select_entry"]) =>
{
if self.modifier_active && self.modifier_command.is_none() {
self.modifier_command = Some(Modifier::default());
@ -1357,8 +1356,10 @@ impl Component for PlainListing {
ShortcutMaps::default()
};
let config_map = context.settings.shortcuts.listing.key_values();
map.insert(Listing::DESCRIPTION, config_map);
map.insert(
Shortcuts::LISTING,
context.settings.shortcuts.listing.key_values(),
);
map
}

@ -1328,19 +1328,19 @@ impl Component for ThreadListing {
match (&event, self.focus) {
(UIEvent::Input(ref k), Focus::Entry)
if shortcut!(k == shortcuts[Listing::DESCRIPTION]["focus_right"]) =>
if shortcut!(k == shortcuts[Shortcuts::LISTING]["focus_right"]) =>
{
self.set_focus(Focus::EntryFullscreen, context);
return true;
}
(UIEvent::Input(ref k), Focus::EntryFullscreen)
if shortcut!(k == shortcuts[Listing::DESCRIPTION]["focus_left"]) =>
if shortcut!(k == shortcuts[Shortcuts::LISTING]["focus_left"]) =>
{
self.set_focus(Focus::Entry, context);
return true;
}
(UIEvent::Input(ref k), Focus::Entry)
if shortcut!(k == shortcuts[Listing::DESCRIPTION]["focus_left"]) =>
if shortcut!(k == shortcuts[Shortcuts::LISTING]["focus_left"]) =>
{
self.set_focus(Focus::None, context);
return true;
@ -1385,29 +1385,29 @@ impl Component for ThreadListing {
}
UIEvent::Input(ref k)
if matches!(self.focus, Focus::None)
&& (shortcut!(k == shortcuts[Listing::DESCRIPTION]["open_entry"])
|| shortcut!(k == shortcuts[Listing::DESCRIPTION]["focus_right"])) =>
&& (shortcut!(k == shortcuts[Shortcuts::LISTING]["open_entry"])
|| shortcut!(k == shortcuts[Shortcuts::LISTING]["focus_right"])) =>
{
self.set_focus(Focus::Entry, context);
return true;
}
UIEvent::Input(ref k)
if !matches!(self.focus, Focus::None)
&& shortcut!(k == shortcuts[Listing::DESCRIPTION]["exit_entry"]) =>
&& shortcut!(k == shortcuts[Shortcuts::LISTING]["exit_entry"]) =>
{
self.set_focus(Focus::None, context);
return true;
}
UIEvent::Input(ref k)
if !matches!(self.focus, Focus::Entry)
&& shortcut!(k == shortcuts[Listing::DESCRIPTION]["focus_right"]) =>
&& shortcut!(k == shortcuts[Shortcuts::LISTING]["focus_right"]) =>
{
self.set_focus(Focus::EntryFullscreen, context);
return true;
}
UIEvent::Input(ref k)
if !matches!(self.focus, Focus::None)
&& shortcut!(k == shortcuts[Listing::DESCRIPTION]["focus_left"]) =>
&& shortcut!(k == shortcuts[Shortcuts::LISTING]["focus_left"]) =>
{
match self.focus {
Focus::Entry => {
@ -1499,7 +1499,7 @@ impl Component for ThreadListing {
}
UIEvent::Input(ref key)
if !self.unfocused()
&& shortcut!(key == shortcuts[Listing::DESCRIPTION]["select_entry"]) =>
&& shortcut!(key == shortcuts[Shortcuts::LISTING]["select_entry"]) =>
{
if self.modifier_active && self.modifier_command.is_none() {
self.modifier_command = Some(Modifier::default());
@ -1600,8 +1600,10 @@ impl Component for ThreadListing {
ShortcutMaps::default()
};
let config_map = context.settings.shortcuts.listing.key_values();
map.insert(Listing::DESCRIPTION, config_map);
map.insert(
Shortcuts::LISTING,
context.settings.shortcuts.listing.key_values(),
);
map
}

@ -33,12 +33,11 @@ pub struct AccountStatus {
impl fmt::Display for AccountStatus {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", AccountStatus::DESCRIPTION)
write!(f, "{}", "status")
}
}
impl AccountStatus {
pub const DESCRIPTION: &'static str = "status";
pub fn new(account_pos: usize, theme_default: ThemeAttribute) -> AccountStatus {
let default_cell = {
let mut ret = Cell::with_char(' ');
@ -407,23 +406,30 @@ impl Component for AccountStatus {
self.dirty = true;
}
UIEvent::Input(ref key)
if shortcut!(key == shortcuts["general"]["scroll_left"]) && self.cursor.0 != 0 =>
if shortcut!(key == shortcuts[Shortcuts::GENERAL]["scroll_left"])
&& self.cursor.0 != 0 =>
{
self.cursor.0 -= 1;
self.dirty = true;
return true;
}
UIEvent::Input(ref key) if shortcut!(key == shortcuts["general"]["scroll_right"]) => {
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Shortcuts::GENERAL]["scroll_right"]) =>
{
self.cursor.0 += 1;
self.dirty = true;
return true;
}
UIEvent::Input(ref key) if shortcut!(key == shortcuts["general"]["scroll_up"]) => {
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Shortcuts::GENERAL]["scroll_up"]) =>
{
self.cursor.1 = self.cursor.1.saturating_sub(1);
self.dirty = true;
return true;
}
UIEvent::Input(ref key) if shortcut!(key == shortcuts["general"]["scroll_down"]) => {
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Shortcuts::GENERAL]["scroll_down"]) =>
{
self.cursor.1 += 1;
self.dirty = true;
return true;
@ -440,10 +446,11 @@ impl Component for AccountStatus {
}
fn get_shortcuts(&self, context: &Context) -> ShortcutMaps {
let config_map: IndexMap<&'static str, Key> =
context.settings.shortcuts.general.key_values();
let mut ret: ShortcutMaps = Default::default();
ret.insert("general", config_map);
let mut ret: ShortcutMaps = ShortcutMaps::default();
ret.insert(
Shortcuts::GENERAL,
context.settings.shortcuts.general.key_values(),
);
ret
}

@ -235,12 +235,11 @@ impl Clone for MailView {
impl fmt::Display for MailView {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", MailView::DESCRIPTION)
write!(f, "{}", "view mail")
}
}
impl MailView {
const DESCRIPTION: &'static str = "view mail";
pub fn new(
coordinates: (AccountHash, MailboxHash, EnvelopeHash),
pager: Option<Pager>,
@ -1702,7 +1701,7 @@ impl Component for MailView {
}
_ => match event {
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Pager::DESCRIPTION]["scroll_up"])
if shortcut!(key == shortcuts[Shortcuts::PAGER]["scroll_up"])
&& !*mailbox_settings!(
context[self.coordinates.0][&self.coordinates.1]
.pager
@ -1720,7 +1719,7 @@ impl Component for MailView {
return true;
}
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Pager::DESCRIPTION]["scroll_down"])
if shortcut!(key == shortcuts[Shortcuts::PAGER]["scroll_down"])
&& !*mailbox_settings!(
context[self.coordinates.0][&self.coordinates.1]
.pager
@ -1926,25 +1925,25 @@ impl Component for MailView {
self.set_dirty(true);
}
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[MailView::DESCRIPTION]["reply"]) =>
if shortcut!(key == shortcuts[Shortcuts::ENVELOPE_VIEW]["reply"]) =>
{
self.perform_action(PendingReplyAction::Reply, context);
return true;
}
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[MailView::DESCRIPTION]["reply_to_all"]) =>
if shortcut!(key == shortcuts[Shortcuts::ENVELOPE_VIEW]["reply_to_all"]) =>
{
self.perform_action(PendingReplyAction::ReplyToAll, context);
return true;
}
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[MailView::DESCRIPTION]["reply_to_author"]) =>
if shortcut!(key == shortcuts[Shortcuts::ENVELOPE_VIEW]["reply_to_author"]) =>
{
self.perform_action(PendingReplyAction::ReplyToAuthor, context);
return true;
}
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[MailView::DESCRIPTION]["forward"]) =>
if shortcut!(key == shortcuts[Shortcuts::ENVELOPE_VIEW]["forward"]) =>
{
match mailbox_settings!(
context[self.coordinates.0][&self.coordinates.1]
@ -1991,7 +1990,7 @@ impl Component for MailView {
return true;
}
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[MailView::DESCRIPTION]["edit"]) =>
if shortcut!(key == shortcuts[Shortcuts::ENVELOPE_VIEW]["edit"]) =>
{
let account_hash = self.coordinates.0;
let env_hash = self.coordinates.2;
@ -2068,7 +2067,7 @@ impl Component for MailView {
UIEvent::Input(ref key)
if !self.mode.is_contact_selector()
&& shortcut!(
key == shortcuts[MailView::DESCRIPTION]["add_addresses_to_contacts"]
key == shortcuts[Shortcuts::ENVELOPE_VIEW]["add_addresses_to_contacts"]
) =>
{
self.start_contact_selector(context);
@ -2103,7 +2102,7 @@ impl Component for MailView {
|| self.mode == ViewMode::Subview
|| self.mode == ViewMode::Source(Source::Decoded)
|| self.mode == ViewMode::Source(Source::Raw))
&& shortcut!(key == shortcuts[MailView::DESCRIPTION]["view_raw_source"]) =>
&& shortcut!(key == shortcuts[Shortcuts::ENVELOPE_VIEW]["view_raw_source"]) =>
{
self.mode = match self.mode {
ViewMode::Source(Source::Decoded) => ViewMode::Source(Source::Raw),
@ -2121,7 +2120,7 @@ impl Component for MailView {
|| self.mode == ViewMode::Source(Source::Decoded)
|| self.mode == ViewMode::Source(Source::Raw))
&& shortcut!(
key == shortcuts[MailView::DESCRIPTION]["return_to_normal_view"]
key == shortcuts[Shortcuts::ENVELOPE_VIEW]["return_to_normal_view"]
) =>
{
self.mode = ViewMode::Normal;
@ -2132,7 +2131,7 @@ impl Component for MailView {
UIEvent::Input(ref key)
if (self.mode == ViewMode::Normal || self.mode == ViewMode::Subview)
&& !self.cmd_buf.is_empty()
&& shortcut!(key == shortcuts[MailView::DESCRIPTION]["open_mailcap"]) =>
&& shortcut!(key == shortcuts[Shortcuts::ENVELOPE_VIEW]["open_mailcap"]) =>
{
let lidx = self.cmd_buf.parse::<usize>().unwrap();
self.cmd_buf.clear();
@ -2164,7 +2163,7 @@ impl Component for MailView {
return true;
}
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[MailView::DESCRIPTION]["open_attachment"])
if shortcut!(key == shortcuts[Shortcuts::ENVELOPE_VIEW]["open_attachment"])
&& !self.cmd_buf.is_empty()
&& (self.mode == ViewMode::Normal || self.mode == ViewMode::Subview) =>
{
@ -2284,7 +2283,7 @@ impl Component for MailView {
UIEvent::Input(ref key)
if (self.mode == ViewMode::Normal || self.mode == ViewMode::Url)
&& shortcut!(
key == shortcuts[MailView::DESCRIPTION]["toggle_expand_headers"]
key == shortcuts[Shortcuts::ENVELOPE_VIEW]["toggle_expand_headers"]
) =>
{
self.expand_headers = !self.expand_headers;
@ -2294,7 +2293,7 @@ impl Component for MailView {
UIEvent::Input(ref key)
if !self.cmd_buf.is_empty()
&& self.mode == ViewMode::Url
&& shortcut!(key == shortcuts[MailView::DESCRIPTION]["go_to_url"]) =>
&& shortcut!(key == shortcuts[Shortcuts::ENVELOPE_VIEW]["go_to_url"]) =>
{
let lidx = self.cmd_buf.parse::<usize>().unwrap();
self.cmd_buf.clear();
@ -2371,7 +2370,7 @@ impl Component for MailView {
}
UIEvent::Input(ref key)
if (self.mode == ViewMode::Normal || self.mode == ViewMode::Url)
&& shortcut!(key == shortcuts[MailView::DESCRIPTION]["toggle_url_mode"]) =>
&& shortcut!(key == shortcuts[Shortcuts::ENVELOPE_VIEW]["toggle_url_mode"]) =>
{
match self.mode {
ViewMode::Normal => self.mode = ViewMode::Url,
@ -2758,7 +2757,7 @@ impl Component for MailView {
if !(self.mode == ViewMode::Normal || self.mode == ViewMode::Url) {
our_map.remove("toggle_url_mode");
}
map.insert(MailView::DESCRIPTION, our_map);
map.insert(Shortcuts::ENVELOPE_VIEW, our_map);
map
}

@ -60,7 +60,6 @@ pub struct ThreadView {
}
impl ThreadView {
const DESCRIPTION: &'static str = "thread view";
/*
* coordinates: (account index, mailbox_hash, root set thread_node index)
* expanded_hash: optional position of expanded entry when we render the threadview. Default
@ -1006,7 +1005,7 @@ impl Component for ThreadView {
let shortcuts = self.get_shortcuts(context);
match *event {
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[ThreadView::DESCRIPTION]["scroll_up"]) =>
if shortcut!(key == shortcuts[Shortcuts::THREAD_VIEW]["scroll_up"]) =>
{
if self.cursor_pos > 0 {
self.new_cursor_pos = self.new_cursor_pos.saturating_sub(1);
@ -1015,7 +1014,7 @@ impl Component for ThreadView {
return true;
}
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[ThreadView::DESCRIPTION]["scroll_down"]) =>
if shortcut!(key == shortcuts[Shortcuts::THREAD_VIEW]["scroll_down"]) =>
{
let height = self.visible_entries.iter().flat_map(|v| v.iter()).count();
if height > 0 && self.new_cursor_pos + 1 < height {
@ -1025,13 +1024,13 @@ impl Component for ThreadView {
return true;
}
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[ThreadView::DESCRIPTION]["prev_page"]) =>
if shortcut!(key == shortcuts[Shortcuts::THREAD_VIEW]["prev_page"]) =>
{
self.movement = Some(PageMovement::PageUp(1));
self.dirty = true;
}
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[ThreadView::DESCRIPTION]["next_page"]) =>
if shortcut!(key == shortcuts[Shortcuts::THREAD_VIEW]["next_page"]) =>
{
self.movement = Some(PageMovement::PageDown(1));
self.dirty = true;
@ -1054,21 +1053,21 @@ impl Component for ThreadView {
return true;
}
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[ThreadView::DESCRIPTION]["toggle_mailview"]) =>
if shortcut!(key == shortcuts[Shortcuts::THREAD_VIEW]["toggle_mailview"]) =>
{
self.show_mailview = !self.show_mailview;
self.set_dirty(true);
return true;
}
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[ThreadView::DESCRIPTION]["toggle_threadview"]) =>
if shortcut!(key == shortcuts[Shortcuts::THREAD_VIEW]["toggle_threadview"]) =>
{
self.show_thread = !self.show_thread;
self.set_dirty(true);
return true;
}
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[ThreadView::DESCRIPTION]["reverse_thread_order"]) =>
if shortcut!(key == shortcuts[Shortcuts::THREAD_VIEW]["reverse_thread_order"]) =>
{
self.reversed = !self.reversed;
let expanded_hash = self.entries[self.expanded_pos].index.1;
@ -1077,7 +1076,7 @@ impl Component for ThreadView {
return true;
}
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[ThreadView::DESCRIPTION]["collapse_subtree"]) =>
if shortcut!(key == shortcuts[Shortcuts::THREAD_VIEW]["collapse_subtree"]) =>
{
let current_pos = self.current_pos();
self.entries[current_pos].hidden = !self.entries[current_pos].hidden;
@ -1157,9 +1156,11 @@ impl Component for ThreadView {
}
fn get_shortcuts(&self, context: &Context) -> ShortcutMaps {
let mut map = self.mailview.get_shortcuts(context);
let config_map = context.settings.shortcuts.thread_view.key_values();
map.insert(ThreadView::DESCRIPTION, config_map);
map.insert(
Shortcuts::THREAD_VIEW,
context.settings.shortcuts.thread_view.key_values(),
);
map
}

@ -63,12 +63,11 @@ pub struct MailboxManager {
impl fmt::Display for MailboxManager {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", MailboxManager::DESCRIPTION)
write!(f, "{}", "mailboxes")
}
}
impl MailboxManager {
const DESCRIPTION: &'static str = "mailboxes";
pub fn new(context: &Context, account_pos: usize) -> Self {
let account_hash = context.accounts[account_pos].hash();
let theme_default = crate::conf::value(context, "theme_default");
@ -431,14 +430,16 @@ impl Component for MailboxManager {
None => self.get_status(context),
})));
}
UIEvent::Input(ref key) if shortcut!(key == shortcuts["general"]["scroll_up"]) => {
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Shortcuts::GENERAL]["scroll_up"]) =>
{
let amount = 1;
self.movement = Some(PageMovement::Up(amount));
self.set_dirty(true);
return true;
}
UIEvent::Input(ref key)
if shortcut!(key == shortcuts["general"]["scroll_down"])
if shortcut!(key == shortcuts[Shortcuts::GENERAL]["scroll_down"])
&& self.cursor_pos < self.length.saturating_sub(1) =>
{
let amount = 1;
@ -446,29 +447,39 @@ impl Component for MailboxManager {
self.movement = Some(PageMovement::Down(amount));
return true;
}
UIEvent::Input(ref key) if shortcut!(key == shortcuts["general"]["prev_page"]) => {
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Shortcuts::GENERAL]["prev_page"]) =>
{
let mult = 1;
self.set_dirty(true);
self.movement = Some(PageMovement::PageUp(mult));
return true;
}
UIEvent::Input(ref key) if shortcut!(key == shortcuts["general"]["next_page"]) => {
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Shortcuts::GENERAL]["next_page"]) =>
{
let mult = 1;
self.set_dirty(true);
self.movement = Some(PageMovement::PageDown(mult));
return true;
}
UIEvent::Input(ref key) if shortcut!(key == shortcuts["general"]["home_page"]) => {
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Shortcuts::GENERAL]["home_page"]) =>
{
self.set_dirty(true);
self.movement = Some(PageMovement::Home);
return true;
}
UIEvent::Input(ref key) if shortcut!(key == shortcuts["general"]["end_page"]) => {
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Shortcuts::GENERAL]["end_page"]) =>
{
self.set_dirty(true);
self.movement = Some(PageMovement::End);
return true;
}
UIEvent::Input(ref key) if shortcut!(key == shortcuts["general"]["open_entry"]) => {
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Shortcuts::GENERAL]["open_entry"]) =>
{
self.set_dirty(true);
self.mode = ViewMode::Action(UIDialog::new(
"select action",
@ -517,8 +528,10 @@ impl Component for MailboxManager {
fn get_shortcuts(&self, context: &Context) -> ShortcutMaps {
let mut map = ShortcutMaps::default();
let config_map = context.settings.shortcuts.general.key_values();
map.insert("general", config_map);
map.insert(
Shortcuts::GENERAL,
context.settings.shortcuts.general.key_values(),
);
map
}

@ -1355,7 +1355,9 @@ impl Component for Tabbed {
}
return true;
}
UIEvent::Input(ref key) if shortcut!(key == shortcuts["general"]["next_tab"]) => {
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Shortcuts::GENERAL]["next_tab"]) =>
{
self.children[self.cursor_pos]
.process_event(&mut UIEvent::VisibilityChange(false), context);
self.cursor_pos = (self.cursor_pos + 1) % self.children.len();
@ -1370,7 +1372,9 @@ impl Component for Tabbed {
self.set_dirty(true);
return true;
}
UIEvent::Input(ref key) if shortcut!(key == shortcuts["general"]["toggle_help"]) => {
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Shortcuts::GENERAL]["toggle_help"]) =>
{
if self.show_shortcuts {
/* children below the shortcut overlay must be redrawn */
self.set_dirty(true);
@ -1474,9 +1478,7 @@ impl Component for Tabbed {
}
UIEvent::Input(ref key)
if self.show_shortcuts
&& shortcut!(
key == shortcuts[super::listing::Listing::DESCRIPTION]["search"]
) =>
&& shortcut!(key == shortcuts[Shortcuts::LISTING]["search"]) =>
{
context
.replies
@ -1488,16 +1490,16 @@ impl Component for Tabbed {
}
UIEvent::Input(ref key) if self.show_shortcuts => {
match key {
_ if shortcut!(key == shortcuts["general"]["scroll_up"]) => {
_ if shortcut!(key == shortcuts[Shortcuts::GENERAL]["scroll_up"]) => {
self.help_screen_cursor.1 = self.help_screen_cursor.1.saturating_sub(1);
}
_ if shortcut!(key == shortcuts["general"]["scroll_down"]) => {
_ if shortcut!(key == shortcuts[Shortcuts::GENERAL]["scroll_down"]) => {
self.help_screen_cursor.1 += 1;
}
_ if shortcut!(key == shortcuts["general"]["scroll_left"]) => {
_ if shortcut!(key == shortcuts[Shortcuts::GENERAL]["scroll_left"]) => {
self.help_screen_cursor.0 = self.help_screen_cursor.0.saturating_sub(1);
}
_ if shortcut!(key == shortcuts["general"]["scroll_right"]) => {
_ if shortcut!(key == shortcuts[Shortcuts::GENERAL]["scroll_right"]) => {
self.help_screen_cursor.0 += 1;
}
_ => {
@ -1540,7 +1542,10 @@ impl Component for Tabbed {
fn get_shortcuts(&self, context: &Context) -> ShortcutMaps {
let mut map = ShortcutMaps::default();
map.insert("general", context.settings.shortcuts.general.key_values());
map.insert(
Shortcuts::GENERAL,
context.settings.shortcuts.general.key_values(),
);
map
}

@ -186,7 +186,7 @@ impl<T: 'static + PartialEq + Debug + Clone + Sync + Send> Component for UIDialo
return true;
}
(UIEvent::Input(ref key), SelectorCursor::Unfocused)
if shortcut!(key == shortcuts["general"]["scroll_down"]) =>
if shortcut!(key == shortcuts[Shortcuts::GENERAL]["scroll_down"]) =>
{
if self.single_only {
for c in self.content.row_iter(0..(width - 1), 0) {
@ -209,7 +209,7 @@ impl<T: 'static + PartialEq + Debug + Clone + Sync + Send> Component for UIDialo
return true;
}
(UIEvent::Input(ref key), SelectorCursor::Entry(c))
if shortcut!(key == shortcuts["general"]["scroll_up"]) && c > 0 =>
if shortcut!(key == shortcuts[Shortcuts::GENERAL]["scroll_up"]) && c > 0 =>
{
if self.single_only {
// Redraw selection
@ -248,7 +248,7 @@ impl<T: 'static + PartialEq + Debug + Clone + Sync + Send> Component for UIDialo
}
(UIEvent::Input(ref key), SelectorCursor::Ok)
| (UIEvent::Input(ref key), SelectorCursor::Cancel)
if shortcut!(key == shortcuts["general"]["scroll_up"]) =>
if shortcut!(key == shortcuts[Shortcuts::GENERAL]["scroll_up"]) =>
{
for c in self
.content
@ -272,7 +272,7 @@ impl<T: 'static + PartialEq + Debug + Clone + Sync + Send> Component for UIDialo
}
(UIEvent::Input(ref key), SelectorCursor::Entry(c))
if c < self.entries.len().saturating_sub(1)
&& shortcut!(key == shortcuts["general"]["scroll_down"]) =>
&& shortcut!(key == shortcuts[Shortcuts::GENERAL]["scroll_down"]) =>
{
if self.single_only {
// Redraw selection
@ -310,7 +310,8 @@ impl<T: 'static + PartialEq + Debug + Clone + Sync + Send> Component for UIDialo
return true;
}
(UIEvent::Input(ref key), SelectorCursor::Entry(c))
if !self.single_only && shortcut!(key == shortcuts["general"]["scroll_down"]) =>
if !self.single_only
&& shortcut!(key == shortcuts[Shortcuts::GENERAL]["scroll_down"]) =>
{
self.cursor = SelectorCursor::Ok;
for c in self.content.row_iter(0..3, c) {
@ -333,7 +334,7 @@ impl<T: 'static + PartialEq + Debug + Clone + Sync + Send> Component for UIDialo
return true;
}
(UIEvent::Input(ref key), SelectorCursor::Ok)
if shortcut!(key == shortcuts["general"]["scroll_right"]) =>
if shortcut!(key == shortcuts[Shortcuts::GENERAL]["scroll_right"]) =>
{
self.cursor = SelectorCursor::Cancel;
for c in self.content.row_iter(
@ -360,7 +361,7 @@ impl<T: 'static + PartialEq + Debug + Clone + Sync + Send> Component for UIDialo
return true;
}
(UIEvent::Input(ref key), SelectorCursor::Cancel)
if shortcut!(key == shortcuts["general"]["scroll_left"]) =>
if shortcut!(key == shortcuts[Shortcuts::GENERAL]["scroll_left"]) =>
{
self.cursor = SelectorCursor::Ok;
for c in self.content.row_iter(
@ -389,10 +390,10 @@ impl<T: 'static + PartialEq + Debug + Clone + Sync + Send> Component for UIDialo
return true;
}
(UIEvent::Input(ref key), _)
if shortcut!(key == shortcuts["general"]["scroll_left"])
|| shortcut!(key == shortcuts["general"]["scroll_right"])
|| shortcut!(key == shortcuts["general"]["scroll_up"])
|| shortcut!(key == shortcuts["general"]["scroll_down"]) =>
if shortcut!(key == shortcuts[Shortcuts::GENERAL]["scroll_left"])
|| shortcut!(key == shortcuts[Shortcuts::GENERAL]["scroll_right"])
|| shortcut!(key == shortcuts[Shortcuts::GENERAL]["scroll_up"])
|| shortcut!(key == shortcuts[Shortcuts::GENERAL]["scroll_down"]) =>
{
return true
}
@ -404,7 +405,10 @@ impl<T: 'static + PartialEq + Debug + Clone + Sync + Send> Component for UIDialo
fn get_shortcuts(&self, context: &Context) -> ShortcutMaps {
let mut map = ShortcutMaps::default();
map.insert("general", context.settings.shortcuts.general.key_values());
map.insert(
Shortcuts::GENERAL,
context.settings.shortcuts.general.key_values(),
);
map
}
@ -511,7 +515,7 @@ impl Component for UIConfirmationDialog {
return true;
}
(UIEvent::Input(ref key), SelectorCursor::Entry(c))
if shortcut!(key == shortcuts["general"]["scroll_up"]) && c > 0 =>
if shortcut!(key == shortcuts[Shortcuts::GENERAL]["scroll_up"]) && c > 0 =>
{
if self.single_only {
// Redraw selection
@ -550,7 +554,7 @@ impl Component for UIConfirmationDialog {
}
(UIEvent::Input(ref key), SelectorCursor::Ok)
| (UIEvent::Input(ref key), SelectorCursor::Cancel)
if shortcut!(key == shortcuts["general"]["scroll_up"]) =>
if shortcut!(key == shortcuts[Shortcuts::GENERAL]["scroll_up"]) =>
{
for c in self
.content
@ -573,7 +577,7 @@ impl Component for UIConfirmationDialog {
return true;
}
(UIEvent::Input(ref key), SelectorCursor::Unfocused)
if shortcut!(key == shortcuts["general"]["scroll_down"]) =>
if shortcut!(key == shortcuts[Shortcuts::GENERAL]["scroll_down"]) =>
{
if self.single_only {
for c in self.content.row_iter(0..(width - 1), 0) {
@ -597,7 +601,7 @@ impl Component for UIConfirmationDialog {
}
(UIEvent::Input(ref key), SelectorCursor::Entry(c))
if c < self.entries.len().saturating_sub(1)
&& shortcut!(key == shortcuts["general"]["scroll_down"]) =>
&& shortcut!(key == shortcuts[Shortcuts::GENERAL]["scroll_down"]) =>
{
if self.single_only {
// Redraw selection
@ -635,7 +639,8 @@ impl Component for UIConfirmationDialog {
return true;
}
(UIEvent::Input(ref key), SelectorCursor::Entry(c))
if !self.single_only && shortcut!(key == shortcuts["general"]["scroll_down"]) =>
if !self.single_only
&& shortcut!(key == shortcuts[Shortcuts::GENERAL]["scroll_down"]) =>
{
self.cursor = SelectorCursor::Ok;
for c in self.content.row_iter(0..3, c) {
@ -658,7 +663,7 @@ impl Component for UIConfirmationDialog {
return true;
}
(UIEvent::Input(ref key), SelectorCursor::Ok)
if shortcut!(key == shortcuts["general"]["scroll_right"]) =>
if shortcut!(key == shortcuts[Shortcuts::GENERAL]["scroll_right"]) =>
{
self.cursor = SelectorCursor::Cancel;
for c in self.content.row_iter(
@ -685,7 +690,7 @@ impl Component for UIConfirmationDialog {
return true;
}
(UIEvent::Input(ref key), SelectorCursor::Cancel)
if shortcut!(key == shortcuts["general"]["scroll_left"]) =>
if shortcut!(key == shortcuts[Shortcuts::GENERAL]["scroll_left"]) =>
{
self.cursor = SelectorCursor::Ok;
for c in self.content.row_iter(
@ -714,10 +719,10 @@ impl Component for UIConfirmationDialog {
return true;
}
(UIEvent::Input(ref key), _)
if shortcut!(key == shortcuts["general"]["scroll_left"])
|| shortcut!(key == shortcuts["general"]["scroll_right"])
|| shortcut!(key == shortcuts["general"]["scroll_up"])
|| shortcut!(key == shortcuts["general"]["scroll_down"]) =>
if shortcut!(key == shortcuts[Shortcuts::GENERAL]["scroll_left"])
|| shortcut!(key == shortcuts[Shortcuts::GENERAL]["scroll_right"])
|| shortcut!(key == shortcuts[Shortcuts::GENERAL]["scroll_up"])
|| shortcut!(key == shortcuts[Shortcuts::GENERAL]["scroll_down"]) =>
{
return true
}
@ -729,7 +734,10 @@ impl Component for UIConfirmationDialog {
fn get_shortcuts(&self, context: &Context) -> ShortcutMaps {
let mut map = ShortcutMaps::default();
map.insert("general", context.settings.shortcuts.general.key_values());
map.insert(
Shortcuts::GENERAL,
context.settings.shortcuts.general.key_values(),
);
map
}

@ -48,13 +48,13 @@ pub struct Pager {
impl fmt::Display for Pager {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", Pager::DESCRIPTION)
write!(f, "{}", "pager")
}
}
impl Pager {
pub const DESCRIPTION: &'static str = "pager";
const PAGES_AHEAD_TO_RENDER_NO: usize = 16;
pub fn new(context: &Context) -> Self {
let mut ret = Pager {
minimum_width: context.settings.pager.minimum_width,
@ -651,48 +651,54 @@ impl Component for Pager {
self.set_dirty(true);
}
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Self::DESCRIPTION]["scroll_up"]) =>
if shortcut!(key == shortcuts[Shortcuts::PAGER]["scroll_up"]) =>
{
self.movement = Some(PageMovement::Up(1));
self.dirty = true;
return true;
}
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Self::DESCRIPTION]["scroll_down"]) =>
if shortcut!(key == shortcuts[Shortcuts::PAGER]["scroll_down"]) =>
{
self.movement = Some(PageMovement::Down(1));
self.dirty = true;
return true;
}
UIEvent::Input(Key::Home) => {
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Shortcuts::GENERAL]["home_page"]) =>
{
self.movement = Some(PageMovement::Home);
self.dirty = true;
return true;
}
UIEvent::Input(Key::End) => {
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Shortcuts::GENERAL]["end_page"]) =>
{
self.movement = Some(PageMovement::End);
self.dirty = true;
return true;
}
UIEvent::Input(Key::Left) => {
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Shortcuts::GENERAL]["scroll_left"]) =>
{
self.movement = Some(PageMovement::Left(1));
self.dirty = true;
return true;
}
UIEvent::Input(Key::Right) => {
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Shortcuts::GENERAL]["scroll_right"]) =>
{
self.movement = Some(PageMovement::Right(1));
self.dirty = true;
return true;
}
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Self::DESCRIPTION]["page_up"]) =>
{
UIEvent::Input(ref key) if shortcut!(key == shortcuts[Shortcuts::PAGER]["page_up"]) => {
self.movement = Some(PageMovement::PageUp(1));
self.dirty = true;
return true;
}
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Self::DESCRIPTION]["page_down"]) =>
if shortcut!(key == shortcuts[Shortcuts::PAGER]["page_down"]) =>
{
self.movement = Some(PageMovement::PageDown(1));
self.dirty = true;
@ -757,27 +763,19 @@ impl Component for Pager {
if let Some(ref mut search) = self.search {
search.movement = Some(PageMovement::Down(1));
search.cursor += 1;
} else {
unsafe {
std::hint::unreachable_unchecked();
}
self.initialised = false;
self.dirty = true;
return true;
}
self.initialised = false;
self.dirty = true;
return true;
}
UIEvent::Input(Key::Char('N')) if self.search.is_some() => {
if let Some(ref mut search) = self.search {
search.movement = Some(PageMovement::Up(1));
search.cursor = search.cursor.saturating_sub(1);
} else {
unsafe {
std::hint::unreachable_unchecked();
}
self.initialised = false;
self.dirty = true;
return true;
}
self.initialised = false;
self.dirty = true;
return true;
}
UIEvent::Input(Key::Esc) if self.search.is_some() => {
self.search = None;
@ -826,9 +824,15 @@ impl Component for Pager {
}
fn get_shortcuts(&self, context: &Context) -> ShortcutMaps {
let config_map: IndexMap<&'static str, Key> = context.settings.shortcuts.pager.key_values();
let mut ret: ShortcutMaps = Default::default();
ret.insert(Pager::DESCRIPTION, config_map);
ret.insert(
Shortcuts::PAGER,
context.settings.shortcuts.pager.key_values(),
);
ret.insert(
Shortcuts::GENERAL,
context.settings.shortcuts.general.key_values(),
);
ret
}

@ -53,6 +53,16 @@ pub struct Shortcuts {
pub pager: PagerShortcuts,
}
impl Shortcuts {
pub const GENERAL: &'static str = "general";
pub const LISTING: &'static str = "listing";
pub const COMPOSING: &'static str = "composing";
pub const CONTACT_LIST: &'static str = "contact_list";
pub const ENVELOPE_VIEW: &'static str = "envelope_view";
pub const THREAD_VIEW: &'static str = "thread_view";
pub const PAGER: &'static str = "pager";
}
impl DotAddressable for Shortcuts {
fn lookup(&self, parent_field: &str, path: &[&str]) -> Result<String> {
match path.first() {
@ -202,6 +212,11 @@ shortcut_key_values! { "general",
scroll_left |> "Generic scroll left (catch-all setting)" |> Key::Left,
scroll_up |> "Generic scroll up (catch-all setting)" |> Key::Char('k'),
scroll_down |> "Generic scroll down (catch-all setting)" |> Key::Char('j'),
next_page |> "Go to next page. (catch-all setting)" |> Key::PageDown,
prev_page |> "Go to previous page. (catch-all setting)" |> Key::PageUp,
home_page |> "Go to first page. (catch-all setting)" |> Key::Home,
end_page |> "Go to last page. (catch-all setting)" |> Key::End,
open_entry |> "Open list entry. (catch-all setting)" |> Key::Char('\n'),
info_message_next |> "Show next info message, if any" |> Key::Alt('>'),
info_message_previous |> "Show previous info message, if any" |> Key::Alt('<'),
focus_in_text_field |> "Focus on a text field." |> Key::Char('\n')

Loading…
Cancel
Save