diff --git a/cbd-tui/src/main.rs b/cbd-tui/src/main.rs index 6a1a4c6..a526de7 100644 --- a/cbd-tui/src/main.rs +++ b/cbd-tui/src/main.rs @@ -52,6 +52,20 @@ trait ListView { fn select(&mut self, idx: Option); fn selected(&self) -> Option; + fn first(&mut self) { + if self.is_empty() { + return; + } + self.select(Some(0)); + } + + fn last(&mut self) { + if self.is_empty() { + return; + } + self.select(Some(self.get_size() - 1)); + } + fn next(&mut self) { if self.is_empty() { return; @@ -521,6 +535,12 @@ fn run_ui(tx: Sender, rx: Receiver) { (_, KeyModifiers::CONTROL, KeyCode::Char('n')) => { app.queue.skip(&tx); } + (UiFocus::Library, KeyModifiers::NONE, KeyCode::Char('g')) => { + app.library.first(); + } + (UiFocus::Library, KeyModifiers::SHIFT, KeyCode::Char('g')) => { + app.library.last(); + } (UiFocus::Library, KeyModifiers::NONE, KeyCode::Char('j')) => { app.library.next(); } @@ -542,6 +562,12 @@ fn run_ui(tx: Sender, rx: Receiver) { (UiFocus::Library, KeyModifiers::NONE, KeyCode::Enter) => { app.library.queue_replace_with_item(&tx); } + (UiFocus::Queue, KeyModifiers::NONE, KeyCode::Char('g')) => { + app.queue.first(); + } + (UiFocus::Queue, KeyModifiers::SHIFT, KeyCode::Char('g')) => { + app.queue.last(); + } (UiFocus::Queue, KeyModifiers::NONE, KeyCode::Char('j')) => { app.queue.next(); }