Minor cosmetic changes

This commit is contained in:
Ticki 2016-03-08 08:19:26 +01:00
parent 0fde52e3f9
commit 491facd4e7
1 changed files with 16 additions and 6 deletions

View File

@ -31,17 +31,27 @@ pub trait TermControl {
/// Go to a given position.
fn goto(&mut self, x: u16, y: u16) -> IoResult<usize> {
self.csi(&[
(x / 10000) as u8 + b'0', (x / 1000) as u8 % 10 + b'0', (x / 100) as u8 % 10 + b'0', (x / 10) as u8 % 10 + b'0', x as u8 % 10 + b'0',
b';',
(y / 10000) as u8 + b'0', (y / 1000) as u8 % 10 + b'0', (y / 100) as u8 % 10 + b'0', (y / 10) as u8 % 10 + b'0', y as u8 % 10 + b'0',
b'H',
b'0' + (x / 10000) as u8,
b'0' + (x / 1000) as u8 % 10,
b'0' + (x / 100) as u8 % 10,
b'0' + (x / 10) as u8 % 10,
b'0' + x as u8 % 10,
b';',
b'0' + (y / 10000) as u8,
b'0' + (y / 1000) as u8 % 10,
b'0' + (y / 100) as u8 % 10,
b'0' + (y / 10) as u8 % 10,
b'0' + y as u8 % 10,
b'H',
])
}
/// Set graphic rendition.
fn rendition(&mut self, r: u8) -> IoResult<usize> {
self.csi(&[
r / 100 + b'0', r / 10 % 10 + b'0', r % 10 + b'0',
b'm',
b'0' + r / 100,
b'0' + r / 10 % 10,
b'0' + r % 10,
b'm',
])
}
/// Set foreground color