Measure automatically in Terminal::present

This commit is contained in:
Joscha 2023-02-17 13:59:04 +01:00
parent e3365fdc02
commit ed14ea9023
5 changed files with 41 additions and 59 deletions

View file

@ -38,19 +38,13 @@ fn draw(f: &mut Frame) {
}
fn render_frame(term: &mut Terminal) {
loop {
// Must be called before rendering, otherwise the terminal has out-of-date
// size information and will present garbage.
// 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() {
term.autoresize().unwrap();
draw(term.frame());
term.present().unwrap();
if term.measuring_required() {
term.measure_widths().unwrap();
} else {
break;
}
}
}