listing: replace hardcoded Key::{Home,End} values with shortcut values
Tests / Test on ${{ matrix.build }} (linux-amd64, ubuntu-latest, stable, x86_64-unknown-linux-gnu) (pull_request) Successful in 9m23s Details
Tests / Test on ${{ matrix.build }} (linux-amd64, ubuntu-latest, stable, x86_64-unknown-linux-gnu) (push) Successful in 13m56s Details

Replace hardcoded Key::{Home,End} values with shortcut values
"home_page" and "end_page".

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
pull/288/head
Manos Pitsidianakis 2023-08-26 11:25:20 +03:00
parent ffba203a3b
commit 9037f08495
Signed by: Manos Pitsidianakis
GPG Key ID: 7729C7707F7E09D0
1 changed files with 20 additions and 5 deletions

View File

@ -1316,7 +1316,14 @@ impl Component for Listing {
return true;
}
let shortcuts = self.shortcuts(context);
let shortcuts = {
let mut m = self.shortcuts(context);
m.insert(
Shortcuts::GENERAL,
context.settings.shortcuts.general.key_values(),
);
m
};
if self.focus == ListingFocus::Mailbox {
match *event {
UIEvent::Input(Key::Mouse(MouseEvent::Press(MouseButton::Left, x, _y)))
@ -1654,11 +1661,15 @@ impl Component for Listing {
self.component.set_movement(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.component.set_movement(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.component.set_movement(PageMovement::End);
return true;
}
@ -2049,7 +2060,9 @@ impl Component for Listing {
return true;
}
UIEvent::Input(ref key) if *key == Key::Home => {
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Shortcuts::GENERAL]["home_page"]) =>
{
if matches!(
self.menu_cursor_pos,
CursorPos {
@ -2072,7 +2085,9 @@ impl Component for Listing {
self.set_dirty(true);
return true;
}
UIEvent::Input(ref key) if *key == Key::End => {
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[Shortcuts::GENERAL]["end_page"]) =>
{
let CursorPos {
ref mut account,
ref mut menu,