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 Ok(Some(key_event)) = keyboard.add_byte(scancode) {
|
||||||
if let Some(key) = keyboard.process_keyevent(key_event) {
|
if let Some(key) = keyboard.process_keyevent(key_event) {
|
||||||
match key {
|
match key {
|
||||||
DecodedKey::Unicode(character) => print!("{}", character),
|
DecodedKey::Unicode(character) => match character {
|
||||||
DecodedKey::RawKey(key) => print!("{:?}", key),
|
'\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 {
|
impl fmt::Write for Writer {
|
||||||
|
|||||||
Reference in New Issue
Block a user