Added Backspace Support
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user