diff options
author | Jesse Luehrs <doy@tozt.net> | 2021-12-04 19:50:01 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2021-12-04 19:50:01 -0500 |
commit | bc2d9265795694f6cfdb72a745a2912209680478 (patch) | |
tree | fb9ad4e0da7fb32fa33470b6bce2bbcdb46e77fd | |
parent | ec6772bfd75aa2be226fe8763ab31a91b941cfc9 (diff) | |
download | ttyrec-bin-bc2d9265795694f6cfdb72a745a2912209680478.tar.gz ttyrec-bin-bc2d9265795694f6cfdb72a745a2912209680478.zip |
only draw the ui if paused
-rw-r--r-- | src/bin/ttyplay/display.rs | 39 |
1 files changed, 19 insertions, 20 deletions
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?; |