Skip to content

Commit 39cdd60

Browse files
committed
rendy: Print a question mark for unknown characters
1 parent 365366d commit 39cdd60

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/aero_kernel/src/rendy.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,11 @@ impl<'this> DebugRendy<'this> {
605605
}
606606

607607
fn plot_char(&mut self, x: usize, y: usize, char: Character) {
608+
let ch = match char.char {
609+
ch if ch.is_ascii() => ch,
610+
_ => '?' as char,
611+
};
612+
608613
if x >= self.cols || y >= self.rows {
609614
return;
610615
}
@@ -615,7 +620,7 @@ impl<'this> DebugRendy<'this> {
615620
let glyph = unsafe {
616621
self.vga_font_bool
617622
.as_ptr()
618-
.add(char.char as usize * DEFAULT_FONT_HEIGHT * DEFAULT_FONT_WIDTH)
623+
.add(ch as usize * DEFAULT_FONT_HEIGHT * DEFAULT_FONT_WIDTH)
619624
};
620625

621626
// naming: fx, fy for font coordinates and gx, gy for glyph coordinates

0 commit comments

Comments
 (0)