terminal: fix write loop
This commit is contained in:
parent
2a79b2753c
commit
49f189f3db
1 changed files with 3 additions and 2 deletions
|
@ -65,11 +65,11 @@ impl Terminal {
|
||||||
termion::clear::All,
|
termion::clear::All,
|
||||||
termion::cursor::Goto(1, 1),
|
termion::cursor::Goto(1, 1),
|
||||||
termion::cursor::Hide,
|
termion::cursor::Hide,
|
||||||
termion::cursor::Goto(1, 1))?;
|
termion::style::Reset)?;
|
||||||
|
|
||||||
while let Some(atoms) = recv.recv().await {
|
while let Some(atoms) = recv.recv().await {
|
||||||
for (pos, atom) in atoms.into_iter() {
|
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))?;
|
write!(out, "{}", termion::cursor::Goto(pos.x as u16 + 1, pos.y as u16 + 1))?;
|
||||||
}
|
}
|
||||||
cur_pos = pos;
|
cur_pos = pos;
|
||||||
|
@ -83,6 +83,7 @@ impl Terminal {
|
||||||
write!(out, "{}", atom.c.unwrap_or(' '))?;
|
write!(out, "{}", atom.c.unwrap_or(' '))?;
|
||||||
} else {
|
} else {
|
||||||
write!(out, "{} ", termion::style::Reset)?;
|
write!(out, "{} ", termion::style::Reset)?;
|
||||||
|
cur_style = TerminalStyle::default();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue