Don't measure widths while presenting

This commit is contained in:
Joscha 2023-02-17 18:59:25 +01:00
parent fae12a4b9f
commit ba6ee45110
5 changed files with 56 additions and 49 deletions

View file

@ -12,13 +12,12 @@ fn draw(f: &mut Frame) {
}
fn render_frame(term: &mut Terminal) {
// Must be called before rendering, otherwise the terminal has out-of-date
// size information and will present garbage.
term.autoresize().unwrap();
draw(term.frame());
while term.present().unwrap() {
let mut dirty = true;
while dirty {
dirty = term.measure_widths().unwrap();
term.autoresize().unwrap();
draw(term.frame());
term.present().unwrap();
}
}