Skip to content

Commit 4515a06

Browse files
rendy_write_character: implement '\t'
Signed-off-by: Andy-Python-Programmer <[email protected]>
1 parent e62bc9d commit 4515a06

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/aero_kernel/src/rendy.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ const DEFAULT_FONT_HEIGHT: usize = 16;
5555

5656
const DEFAULT_MARGIN: usize = 64 / 2;
5757

58+
const TAB_SIZE: usize = 4;
59+
5860
/// The amount of VGA font glyphs.
5961
const VGA_FONT_GLYPHS: usize = 256;
6062

@@ -723,6 +725,16 @@ impl<'this> DebugRendy<'this> {
723725
fn write_character(&mut self, char: char) {
724726
match char {
725727
'\n' => self.newline(),
728+
729+
'\t' => {
730+
if (self.x_pos / TAB_SIZE + 1) >= self.cols {
731+
self.set_cursor_position(self.cols - 1, self.y_pos);
732+
return;
733+
}
734+
735+
self.set_cursor_position((self.x_pos / TAB_SIZE + 1) * TAB_SIZE, self.y_pos);
736+
}
737+
726738
'\r' => {}
727739

728740
_ => {

0 commit comments

Comments
 (0)