mirror of
https://github.com/figsoda/mmtc
synced 2024-11-26 08:50:18 +00:00
press spacebar to reset selection
This commit is contained in:
parent
25e6644f30
commit
d5cd92ae3a
1 changed files with 9 additions and 0 deletions
|
@ -47,6 +47,7 @@ enum Command {
|
||||||
UpdateStatus,
|
UpdateStatus,
|
||||||
TogglePause,
|
TogglePause,
|
||||||
Play,
|
Play,
|
||||||
|
Reselect,
|
||||||
Down,
|
Down,
|
||||||
Up,
|
Up,
|
||||||
JumpDown,
|
JumpDown,
|
||||||
|
@ -131,6 +132,9 @@ async fn run() -> Result<()> {
|
||||||
KeyCode::Enter => {
|
KeyCode::Enter => {
|
||||||
tx.send(Command::Play).await.unwrap_or_else(die);
|
tx.send(Command::Play).await.unwrap_or_else(die);
|
||||||
}
|
}
|
||||||
|
KeyCode::Char(' ') => {
|
||||||
|
tx.send(Command::Reselect).await.unwrap_or_else(die);
|
||||||
|
}
|
||||||
KeyCode::Char('j') | KeyCode::Down => {
|
KeyCode::Char('j') | KeyCode::Down => {
|
||||||
tx.send(Command::Down).await.unwrap_or_else(die);
|
tx.send(Command::Down).await.unwrap_or_else(die);
|
||||||
}
|
}
|
||||||
|
@ -196,6 +200,11 @@ async fn run() -> Result<()> {
|
||||||
}
|
}
|
||||||
tx.send(Command::UpdateStatus).await?;
|
tx.send(Command::UpdateStatus).await?;
|
||||||
}
|
}
|
||||||
|
Command::Reselect => {
|
||||||
|
selected = status.song.map_or(0, |song| song.pos);
|
||||||
|
liststate.select(Some(selected));
|
||||||
|
tx.send(Command::UpdateFrame).await?;
|
||||||
|
}
|
||||||
Command::Down => {
|
Command::Down => {
|
||||||
let len = queue.len();
|
let len = queue.len();
|
||||||
if selected >= len {
|
if selected >= len {
|
||||||
|
|
Loading…
Reference in a new issue