From 5eafc1898bf41ce2e6d3a634724f9443546af614 Mon Sep 17 00:00:00 2001 From: krolxon Date: Sun, 28 Apr 2024 16:27:03 +0530 Subject: keybind: goto top, bottom --- src/app.rs | 1 - src/handler.rs | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/app.rs b/src/app.rs index 081efc6..5c74245 100755 --- a/src/app.rs +++ b/src/app.rs @@ -160,7 +160,6 @@ impl App { browser.prev_path = browser.path.clone(); browser.path = browser.prev_path.clone() + "/" + path; browser.update_directory(&mut self.conn)?; - // self.get_all_rsongs(conn)?; browser.prev_selected = browser.selected; browser.selected = 0; } diff --git a/src/handler.rs b/src/handler.rs index ab09050..91dcec7 100755 --- a/src/handler.rs +++ b/src/handler.rs @@ -329,6 +329,23 @@ pub fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult<()> { // Change playlist name KeyCode::Char('e') => if app.selected_tab == SelectedTab::Playlists {}, + // go to top of list + KeyCode::Char('g') => { + match app.selected_tab { + SelectedTab::Queue => app.queue_list.index = 0, + SelectedTab::DirectoryBrowser => app.browser.selected = 0, + SelectedTab::Playlists => app.pl_list.index = 0 + } + } + + // go to bottom of list + KeyCode::Char('G') => { + match app.selected_tab { + SelectedTab::Queue => app.queue_list.index = app.queue_list.list.len() - 1, + SelectedTab::DirectoryBrowser => app.browser.selected = app.browser.filetree.len() - 1, + SelectedTab::Playlists => app.pl_list.index = app.pl_list.list.len() - 1 + } + } _ => {} } } -- cgit v1.2.3