From 114baa01288642ae6d489029283736fd2fd26565 Mon Sep 17 00:00:00 2001 From: NatrixAeria Date: Fri, 16 Apr 2021 21:13:21 +0200 Subject: Fix VgaChar's byte and color state setter --- kernel/src/io/vga_text.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/kernel/src/io/vga_text.rs b/kernel/src/io/vga_text.rs index e44d341..3d5b3fd 100644 --- a/kernel/src/io/vga_text.rs +++ b/kernel/src/io/vga_text.rs @@ -28,13 +28,13 @@ impl VgaChar { } pub fn set_byte(&mut self, byte: u8) { - let byte = u16::to_ne_bytes(self.0)[0]; - self.0 = u16::from_ne_bytes([byte, byte]); + let color = u16::to_ne_bytes(self.0)[1]; + *self = Self::from_byte_with_color_state(byte, color); } - pub fn set_color(&mut self, byte: u8) { - let color = u16::to_ne_bytes(self.0)[1]; - self.0 = u16::from_ne_bytes([byte, color]); + pub fn set_color(&mut self, color: u8) { + let byte = u16::to_ne_bytes(self.0)[0]; + *self = Self::from_byte_with_color_state(byte, color); } } -- cgit v1.2.3