From bd2b5327d042f5bf04ae7089d8b36c113313f8f3 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 30 Oct 2018 11:55:58 +0100 Subject: [PATCH] Basic support the backspace key. This doesn't mean we get any line editing just yet. But the keyboard device now recognizes the backspace key, and the console device knows what to do with the backspace characters. --- Kernel/Console.cpp | 8 ++++++++ Kernel/Keyboard.cpp | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Kernel/Console.cpp b/Kernel/Console.cpp index 207bd3115d..9bb4f0cb14 100644 --- a/Kernel/Console.cpp +++ b/Kernel/Console.cpp @@ -303,6 +303,14 @@ void Console::putChar(char ch) case '\033': m_escState = ExpectBracket; return; + case 8: // Backspace + if (m_cursorColumn) { + --m_cursorColumn;\ + vga_set_cursor(m_cursorRow, m_cursorColumn); + vga_putch_at(m_cursorRow, m_cursorColumn, ' '); + return; + } + break; case '\n': scrollup(); vga_set_cursor(m_cursorRow, m_cursorColumn); diff --git a/Kernel/Keyboard.cpp b/Kernel/Keyboard.cpp index f23f5bbbd5..cd41f2723c 100644 --- a/Kernel/Keyboard.cpp +++ b/Kernel/Keyboard.cpp @@ -21,7 +21,7 @@ static char map[0x100] = { - 0, 0, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', 0, 0, + 0, 0, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', 0x08, 0, 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', 0, 0, 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'', '`', 0, '\\', 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/',