Added Backspace Support

This commit is contained in:
2026-03-30 18:23:08 +03:00
parent f121e3d33a
commit c7c2905b40
2 changed files with 17 additions and 2 deletions

View File

@@ -72,8 +72,15 @@ extern "x86-interrupt" fn keyboard_interrupt_handler(_stack_frame: InterruptStac
if let Ok(Some(key_event)) = keyboard.add_byte(scancode) {
if let Some(key) = keyboard.process_keyevent(key_event) {
match key {
DecodedKey::Unicode(character) => print!("{}", character),
DecodedKey::RawKey(key) => print!("{:?}", key),
DecodedKey::Unicode(character) => match character {
'\x08' => {
use crate::vga_buffer::WRITER;
WRITER.lock().backspace();
}
_ => print!("{}", character),
},
//DecodedKey::RawKey(key) => print!("{:?}", key),
DecodedKey::RawKey(_) => {} // ignoring raw keys
}
}
}

View File

@@ -109,6 +109,14 @@ impl Writer {
}
}
}
pub fn backspace(&mut self) {
if self.column_position > 0 {
self.column_position -= 1;
self.write_byte(b' ');
self.column_position -= 1;
}
}
}
impl fmt::Write for Writer {