Go to first, last item in list
This commit is contained in:
parent
10abece425
commit
eabe115759
|
|
@ -52,6 +52,20 @@ trait ListView {
|
||||||
fn select(&mut self, idx: Option<usize>);
|
fn select(&mut self, idx: Option<usize>);
|
||||||
fn selected(&self) -> Option<usize>;
|
fn selected(&self) -> Option<usize>;
|
||||||
|
|
||||||
|
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) {
|
fn next(&mut self) {
|
||||||
if self.is_empty() {
|
if self.is_empty() {
|
||||||
return;
|
return;
|
||||||
|
|
@ -521,6 +535,12 @@ fn run_ui(tx: Sender<MessageFromUi>, rx: Receiver<MessageToUi>) {
|
||||||
(_, KeyModifiers::CONTROL, KeyCode::Char('n')) => {
|
(_, KeyModifiers::CONTROL, KeyCode::Char('n')) => {
|
||||||
app.queue.skip(&tx);
|
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')) => {
|
(UiFocus::Library, KeyModifiers::NONE, KeyCode::Char('j')) => {
|
||||||
app.library.next();
|
app.library.next();
|
||||||
}
|
}
|
||||||
|
|
@ -542,6 +562,12 @@ fn run_ui(tx: Sender<MessageFromUi>, rx: Receiver<MessageToUi>) {
|
||||||
(UiFocus::Library, KeyModifiers::NONE, KeyCode::Enter) => {
|
(UiFocus::Library, KeyModifiers::NONE, KeyCode::Enter) => {
|
||||||
app.library.queue_replace_with_item(&tx);
|
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')) => {
|
(UiFocus::Queue, KeyModifiers::NONE, KeyCode::Char('j')) => {
|
||||||
app.queue.next();
|
app.queue.next();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue