fix for grey lines from the left that should be black, and re-show cursor

This commit is contained in:
lifning 2021-11-26 18:52:36 -08:00
parent 01a1b790ae
commit d8a403110f
1 changed files with 8 additions and 1 deletions

View File

@ -89,6 +89,12 @@ impl Default for AnsiVideoComponent {
}
}
impl Drop for AnsiVideoComponent {
fn drop(&mut self) {
write!(self.screen, "{}", termion::cursor::Show).unwrap();
}
}
impl RetroCallbacks for AnsiVideoComponent {
fn video_refresh(&mut self, frame: &VideoFrame) {
match frame {
@ -141,8 +147,9 @@ impl RetroCallbacks for AnsiVideoComponent {
let processed = processor.process(&rgba_img).into_iter().next().unwrap().1;
write!(self.screen, "{}", termion::cursor::Goto(1, 1)).unwrap();
for line in self.encode_frame(&processed).lines() {
write!(self.screen, "{}\x1B[0m\r\n", line).unwrap();
write!(self.screen, "{}{}\r\n", line, termion::color::Fg(termion::color::Black)).unwrap();
}
write!(self.screen, "\x1B[0m").unwrap();
self.screen.flush().unwrap();
} else if force_redraw {
// TODO: draw last copy