summaryrefslogtreecommitdiff
path: root/kernel/src/io/vga_text.rs
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/src/io/vga_text.rs')
-rw-r--r--kernel/src/io/vga_text.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/kernel/src/io/vga_text.rs b/kernel/src/io/vga_text.rs
index b6715fd..34f13a8 100644
--- a/kernel/src/io/vga_text.rs
+++ b/kernel/src/io/vga_text.rs
@@ -30,7 +30,7 @@ impl CharState {
}
pub fn set_fg(&mut self, fg: Color) {
- self.0 = (self.0 & HEIGHT - 10) | (fg as u8)
+ self.0 = (self.0 & (HEIGHT as u8) - 10) | (fg as u8)
}
pub fn set_bg(&mut self, bg: Color) {
@@ -52,7 +52,7 @@ impl VgaChar {
}
pub struct OStream {
- pos: (u8, u8),
+ pos: (usize, usize),
cursor: *mut VgaChar,
state: CharState,
}
@@ -74,16 +74,16 @@ impl OStream {
self.cursor = Self::at(self.pos.0 as usize + self.pos.1 as usize * WIDTH)
}
- pub fn set_col(&mut self, col: u8) {
+ pub fn set_col(&mut self, col: usize) {
self.pos.0 = core::cmp::min(col, WIDTH - 1);
self.compute_cursor()
}
- pub fn set_row(&mut self, row: u8) {
+ pub fn set_row(&mut self, row: usize) {
self.pos.1 = core::cmp::min(row, HEIGHT - 1);
self.compute_cursor()
}
- pub fn set_cursor(&mut self, col: u8, row: u8) {
+ pub fn set_cursor(&mut self, col: usize, row: usize) {
self.pos = (
core::cmp::min(col, WIDTH - 1),
core::cmp::min(row, HEIGHT - 1),
@@ -155,7 +155,7 @@ impl OStream {
if b != b'\n' {
n += 1
}
- self.set_col(((WIDTH - n) / 2) as u8);
+ self.set_col(((WIDTH - n) / 2) as usize);
self.print(&line[..n]);
self.new_line();
if i == slast {