other: don't draw on non-updating events (#924)

This commit is contained in:
Clement Tsang 2022-12-03 01:18:47 -05:00 committed by GitHub
parent 5cce30c7f1
commit d3577bd1ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -162,14 +162,17 @@ fn main() -> Result<()> {
break; break;
} }
update_data(&mut app); update_data(&mut app);
try_drawing(&mut terminal, &mut app, &mut painter)?;
} }
BottomEvent::MouseInput(event) => { BottomEvent::MouseInput(event) => {
handle_mouse_event(event, &mut app); handle_mouse_event(event, &mut app);
update_data(&mut app); update_data(&mut app);
try_drawing(&mut terminal, &mut app, &mut painter)?;
} }
BottomEvent::PasteEvent(paste) => { BottomEvent::PasteEvent(paste) => {
app.handle_paste(paste); app.handle_paste(paste);
update_data(&mut app); update_data(&mut app);
try_drawing(&mut terminal, &mut app, &mut painter)?;
} }
BottomEvent::Update(data) => { BottomEvent::Update(data) => {
app.data_collection.eat_data(data); app.data_collection.eat_data(data);
@ -278,6 +281,7 @@ fn main() -> Result<()> {
} }
update_data(&mut app); update_data(&mut app);
try_drawing(&mut terminal, &mut app, &mut painter)?;
} }
} }
BottomEvent::Clean => { BottomEvent::Clean => {
@ -286,9 +290,6 @@ fn main() -> Result<()> {
} }
} }
} }
// TODO: [OPT] Should not draw if no change (ie: scroll max)
try_drawing(&mut terminal, &mut app, &mut painter)?;
} }
// I think doing it in this order is safe... // I think doing it in this order is safe...