redraw properly when window is resized
This commit is contained in:
parent
1cda5175b7
commit
ad5af6a27a
1 changed files with 17 additions and 13 deletions
12
src/main.rs
12
src/main.rs
|
@ -144,7 +144,7 @@ impl App {
|
||||||
println!("Play/pause: Space\r");
|
println!("Play/pause: Space\r");
|
||||||
println!("Master volume: [.] [,]\r");
|
println!("Master volume: [.] [,]\r");
|
||||||
println!("Select channel: Up/Down\r");
|
println!("Select channel: Up/Down\r");
|
||||||
println!("Mute channel: M\r");
|
println!("Mute channel: [M]\r");
|
||||||
println!("Channel volume: Left/Right\r");
|
println!("Channel volume: Left/Right\r");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,9 +153,11 @@ impl App {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let Ok(Event::Key(event)) = event::read() else { return };
|
match event::read() {
|
||||||
|
Ok(Event::Resize(_, _)) => {
|
||||||
match event.code {
|
stdout().execute(Clear(ClearType::All)).unwrap();
|
||||||
|
}
|
||||||
|
Ok(Event::Key(event)) => match event.code {
|
||||||
KeyCode::Char('q') => self.quit = true,
|
KeyCode::Char('q') => self.quit = true,
|
||||||
KeyCode::Up => self.select_prev(),
|
KeyCode::Up => self.select_prev(),
|
||||||
KeyCode::Down => self.select_next(),
|
KeyCode::Down => self.select_next(),
|
||||||
|
@ -166,6 +168,8 @@ impl App {
|
||||||
KeyCode::Char('.') => self.inc_vol(),
|
KeyCode::Char('.') => self.inc_vol(),
|
||||||
KeyCode::Char(',') => self.dec_vol(),
|
KeyCode::Char(',') => self.dec_vol(),
|
||||||
_ => (),
|
_ => (),
|
||||||
|
},
|
||||||
|
_ => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue