redraw properly when window is resized

This commit is contained in:
Crispy 2023-02-01 21:21:49 +01:00
parent 1cda5175b7
commit ad5af6a27a

View file

@ -144,7 +144,7 @@ impl App {
println!("Play/pause: Space\r");
println!("Master volume: [.] [,]\r");
println!("Select channel: Up/Down\r");
println!("Mute channel: M\r");
println!("Mute channel: [M]\r");
println!("Channel volume: Left/Right\r");
}
@ -153,9 +153,11 @@ impl App {
return;
}
let Ok(Event::Key(event)) = event::read() else { return };
match event.code {
match event::read() {
Ok(Event::Resize(_, _)) => {
stdout().execute(Clear(ClearType::All)).unwrap();
}
Ok(Event::Key(event)) => match event.code {
KeyCode::Char('q') => self.quit = true,
KeyCode::Up => self.select_prev(),
KeyCode::Down => self.select_next(),
@ -166,6 +168,8 @@ impl App {
KeyCode::Char('.') => self.inc_vol(),
KeyCode::Char(',') => self.dec_vol(),
_ => (),
},
_ => (),
}
}