diff --git a/src/lib.rs b/src/lib.rs index 892fe69..5368cdc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -141,8 +141,13 @@ pub trait TermControl { self.csi(b"0m") } /// Go to a given position. - fn goto(&mut self, x: usize, y: usize) -> IoResult { - self.csi(format!("{};{}H", x, y).as_bytes()) + fn goto(&mut self, x: u16, y: u16) -> IoResult { + self.csi(&[ + (x / 10000 % 10) as u8, (x / 1000 % 10) as u8, (x / 100 % 10) as u8, (x / 10 % 10) as u8, (x % 10) as u8, + b';', + (y / 10000 % 10) as u8, (y / 1000 % 10) as u8, (y / 100 % 10) as u8, (y / 10 % 10) as u8, (y % 10) as u8, + b'H', + ]) } }