diff options
Diffstat (limited to 'kernel/src/io')
-rw-r--r-- | kernel/src/io/vga_text.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/kernel/src/io/vga_text.rs b/kernel/src/io/vga_text.rs index 833c191..277db73 100644 --- a/kernel/src/io/vga_text.rs +++ b/kernel/src/io/vga_text.rs @@ -160,10 +160,11 @@ impl OStream { pub fn print_centered(&mut self, s: &[u8]) { let mut line_start = 0; let mut line_len = 0; - for chunk in s.chunks(WIDTH) { - for line in chunk.split(|&c| c == b'\n') { - self.set_col((WIDTH - line.len()) >> 1); - self.put_bytes(line); + for line in s.split(|&c| c == b'\n') { + if line.is_empty() { self.new_line() } + for chunk in line.chunks(WIDTH) { + self.set_col((WIDTH - chunk.len()) >> 1); + self.put_bytes(chunk); self.new_line() } } |