From bc2d9265795694f6cfdb72a745a2912209680478 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sat, 4 Dec 2021 19:50:01 -0500 Subject: only draw the ui if paused --- src/bin/ttyplay/display.rs | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/bin/ttyplay/display.rs b/src/bin/ttyplay/display.rs index 32226e1..c06e849 100644 --- a/src/bin/ttyplay/display.rs +++ b/src/bin/ttyplay/display.rs @@ -40,35 +40,34 @@ impl Display { ) -> anyhow::Result<()> { output.clear(); output.move_to(0, 0); - output.reset_attributes(); output.write(&screen.contents_formatted()); - let pos = output.screen().cursor_position(); + if self.paused { + let pos = output.screen().cursor_position(); - output.move_to(0, 0); - output.reset_attributes(); - output.set_fgcolor(textmode::color::BLACK); - if self.done_loading { - output.set_bgcolor(textmode::color::CYAN); - } else { - output.set_bgcolor(textmode::color::RED); - } - output.write_str(&format!( - " {}/{} ", - self.current_frame + 1, - self.total_frames - )); + output.move_to(0, 0); + output.reset_attributes(); + output.set_fgcolor(textmode::color::BLACK); + if self.done_loading { + output.set_bgcolor(textmode::color::CYAN); + } else { + output.set_bgcolor(textmode::color::RED); + } + output.write_str(&format!( + " {}/{} ", + self.current_frame + 1, + self.total_frames + )); - if self.paused { let size = output.screen().size(); output.move_to(0, size.1 - 1); output.reset_attributes(); output.set_fgcolor(textmode::color::BLACK); output.set_bgcolor(textmode::color::RED); - output.write_str("⏸") - } + output.write_str("⏸"); - output.reset_attributes(); - output.move_to(pos.0, pos.1); + output.reset_attributes(); + output.move_to(pos.0, pos.1); + } output.refresh().await?; -- cgit v1.2.3-54-g00ecf