redraw properly when window is resized
This commit is contained in:
parent
1cda5175b7
commit
ad5af6a27a
1 changed files with 17 additions and 13 deletions
30
src/main.rs
30
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,18 +153,22 @@ 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();
|
||||||
KeyCode::Char('q') => self.quit = true,
|
}
|
||||||
KeyCode::Up => self.select_prev(),
|
Ok(Event::Key(event)) => match event.code {
|
||||||
KeyCode::Down => self.select_next(),
|
KeyCode::Char('q') => self.quit = true,
|
||||||
KeyCode::Right => self.channels[self.selected].change_vol(10),
|
KeyCode::Up => self.select_prev(),
|
||||||
KeyCode::Left => self.channels[self.selected].change_vol(-10),
|
KeyCode::Down => self.select_next(),
|
||||||
KeyCode::Char('m') => self.channels[self.selected].mute(),
|
KeyCode::Right => self.channels[self.selected].change_vol(10),
|
||||||
KeyCode::Char(' ') => self.mute(),
|
KeyCode::Left => self.channels[self.selected].change_vol(-10),
|
||||||
KeyCode::Char('.') => self.inc_vol(),
|
KeyCode::Char('m') => self.channels[self.selected].mute(),
|
||||||
KeyCode::Char(',') => self.dec_vol(),
|
KeyCode::Char(' ') => self.mute(),
|
||||||
|
KeyCode::Char('.') => self.inc_vol(),
|
||||||
|
KeyCode::Char(',') => self.dec_vol(),
|
||||||
|
_ => (),
|
||||||
|
},
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue