rmptui5eafc18
keybind: goto top, bottom
+20 −2
3 files changed
- M README.md +3 −1
- M src/app.rs +0 −1
- M src/handler.rs +17 −0
| @@ -20,7 +20,7 @@ A MPD client in Rust | |||
| 20 | 20 | - `3` to go to playlists view | |
| 21 | 21 | - `Enter` to add song/playlist to current playlist | |
| 22 | 22 | - `a` to append the song to current playing queue | |
| 23 | − | - `BackSpace` to delete the highlighted song from queue | |
| 23 | + | - `Space`/`BackSpace` to delete the highlighted song from queue | |
| 24 | 24 | - `f` to go forwards | |
| 25 | 25 | - `b` to go backwards | |
| 26 | 26 | - `>` to play next song from queue | |
| @@ -29,6 +29,8 @@ A MPD client in Rust | |||
| 29 | 29 | - `r` to toggle repeat | |
| 30 | 30 | - `z` to toggle random | |
| 31 | 31 | - `/` to search | |
| 32 | + | - `g` to go to top of list | |
| 33 | + | - `G` to go to bottom of list | |
| 32 | 34 | ||
| 33 | 35 | ### TODO | |
| 34 | 36 | - [x] fix performance issues | |
| @@ -160,7 +160,6 @@ impl App { | |||
| 160 | 160 | browser.prev_path = browser.path.clone(); | |
| 161 | 161 | browser.path = browser.prev_path.clone() + "/" + path; | |
| 162 | 162 | browser.update_directory(&mut self.conn)?; | |
| 163 | − | // self.get_all_rsongs(conn)?; | |
| 164 | 163 | browser.prev_selected = browser.selected; | |
| 165 | 164 | browser.selected = 0; | |
| 166 | 165 | } | |
| @@ -329,6 +329,23 @@ pub fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult<()> { | |||
| 329 | 329 | // Change playlist name | |
| 330 | 330 | KeyCode::Char('e') => if app.selected_tab == SelectedTab::Playlists {}, | |
| 331 | 331 | ||
| 332 | + | // go to top of list | |
| 333 | + | KeyCode::Char('g') => { | |
| 334 | + | match app.selected_tab { | |
| 335 | + | SelectedTab::Queue => app.queue_list.index = 0, | |
| 336 | + | SelectedTab::DirectoryBrowser => app.browser.selected = 0, | |
| 337 | + | SelectedTab::Playlists => app.pl_list.index = 0 | |
| 338 | + | } | |
| 339 | + | } | |
| 340 | + | ||
| 341 | + | // go to bottom of list | |
| 342 | + | KeyCode::Char('G') => { | |
| 343 | + | match app.selected_tab { | |
| 344 | + | SelectedTab::Queue => app.queue_list.index = app.queue_list.list.len() - 1, | |
| 345 | + | SelectedTab::DirectoryBrowser => app.browser.selected = app.browser.filetree.len() - 1, | |
| 346 | + | SelectedTab::Playlists => app.pl_list.index = app.pl_list.list.len() - 1 | |
| 347 | + | } | |
| 348 | + | } | |
| 332 | 349 | _ => {} | |
| 333 | 350 | } | |
| 334 | 351 | } | |