From 49f189f3dbc6d6b4f3eac82c4c692fc9df29a9c3 Mon Sep 17 00:00:00 2001 From: Michael Sippel Date: Mon, 14 Dec 2020 19:17:51 +0100 Subject: [PATCH] terminal: fix write loop --- src/terminal/terminal.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/terminal/terminal.rs b/src/terminal/terminal.rs index 7ee9cf1..68dcccb 100644 --- a/src/terminal/terminal.rs +++ b/src/terminal/terminal.rs @@ -65,11 +65,11 @@ impl Terminal { termion::clear::All, termion::cursor::Goto(1, 1), termion::cursor::Hide, - termion::cursor::Goto(1, 1))?; + termion::style::Reset)?; while let Some(atoms) = recv.recv().await { for (pos, atom) in atoms.into_iter() { - if pos != cur_pos { + if pos != cur_pos+Vector2::new(1,0) { write!(out, "{}", termion::cursor::Goto(pos.x as u16 + 1, pos.y as u16 + 1))?; } cur_pos = pos; @@ -83,6 +83,7 @@ impl Terminal { write!(out, "{}", atom.c.unwrap_or(' '))?; } else { write!(out, "{} ", termion::style::Reset)?; + cur_style = TerminalStyle::default(); } }