Fix rendering when resizing

This commit is contained in:
Joscha 2022-07-20 23:54:31 +02:00
parent 15f628aaad
commit 5210ad1eba

View file

@ -139,11 +139,11 @@ impl Ui {
Some(event) => event, Some(event) => event,
None => return Ok(()), None => return Ok(()),
}; };
terminal.autoresize()?;
loop { loop {
// Render in-between events so the next event is handled in an // Render in-between events so the next event is handled in an
// up-to-date state. The results of these intermediate renders // up-to-date state. The results of these intermediate renders
// will be thrown away before the final render. // will be thrown away before the final render.
terminal.autoresize()?;
self.widget().await.render(terminal.frame()).await; self.widget().await.render(terminal.frame()).await;
let result = match event { let result = match event {
@ -167,6 +167,7 @@ impl Ui {
} }
// 3. Render and present final state // 3. Render and present final state
terminal.autoresize()?;
terminal.frame().reset(); terminal.frame().reset();
self.widget().await.render(terminal.frame()).await; self.widget().await.render(terminal.frame()).await;
terminal.present()?; terminal.present()?;