Skip to content
Snippets Groups Projects
Commit 1e30802d authored by Ticki's avatar Ticki
Browse files

u16 instead, don't allocate for formatting

parent 8a172fdb
No related branches found
No related tags found
No related merge requests found
......@@ -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<usize> {
self.csi(format!("{};{}H", x, y).as_bytes())
fn goto(&mut self, x: u16, y: u16) -> IoResult<usize> {
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',
])
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment