Slight refactoring.
This commit is contained in:
parent
68dab474ef
commit
ce7f5a43ea
1 changed files with 6 additions and 3 deletions
|
@ -168,20 +168,23 @@ impl Clock {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn draw_digit_pair<W: Write>(
|
fn draw_digit_pair<W: Write>(
|
||||||
&self,
|
&mut self,
|
||||||
stdout: &mut RawTerminal<W>,
|
stdout: &mut RawTerminal<W>,
|
||||||
value: u32,
|
value: u32,
|
||||||
pos: &Position,
|
pos: &Position,
|
||||||
) -> Result<(), std::io::Error>
|
) -> Result<(), std::io::Error>
|
||||||
{
|
{
|
||||||
|
let left = value / 10;
|
||||||
|
let right = value % 10;
|
||||||
|
|
||||||
for l in 0..self.font.height {
|
for l in 0..self.font.height {
|
||||||
write!(stdout,
|
write!(stdout,
|
||||||
"{}{} {}",
|
"{}{} {}",
|
||||||
cursor::Goto(pos.col, pos.line + l),
|
cursor::Goto(pos.col, pos.line + l),
|
||||||
// First digit.
|
// First digit.
|
||||||
self.font.digits[(value / 10) as usize][l as usize],
|
self.font.digits[left as usize][l as usize],
|
||||||
// Second digit.
|
// Second digit.
|
||||||
self.font.digits[(value % 10) as usize][l as usize]
|
self.font.digits[right as usize][l as usize]
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
Loading…
Reference in a new issue