fix something- possibly terminal size change

daddy
elfein727 2021-12-28 00:22:21 -08:00
parent 1f3b1dde50
commit b24b7f81d1
1 changed files with 2 additions and 1 deletions

View File

@ -1,7 +1,7 @@
use crossterm::{
cursor, queue,
style::{self, Stylize},
terminal::{size, Clear, ClearType},
terminal::{self, size, Clear, ClearType},
ExecutableCommand, QueueableCommand, Result as CTRes,
};
use std::{
@ -96,6 +96,7 @@ impl<'a, T: Data> Window<T> {
self.root_widget.update(&self.data);
let terminal_size = size()?;
if self.data.changed() || self.size != terminal_size.into() {
self.size = terminal_size.into();
queue![self.out, Clear(ClearType::All)]?;
self.out.flush()?;
self.buf = vec![' '; terminal_size.0 as usize * terminal_size.1 as usize];