diff --git a/kernel/kernel/Terminal/TTY.cpp b/kernel/kernel/Terminal/TTY.cpp index 2f5b3d69..b6024ef2 100644 --- a/kernel/kernel/Terminal/TTY.cpp +++ b/kernel/kernel/Terminal/TTY.cpp @@ -222,6 +222,9 @@ namespace Kernel case LibInput::Key::Escape: ansi_c_str = "\e"; break; + case LibInput::Key::Delete: + ansi_c_str = "\x7F"; + break; case LibInput::Key::ArrowUp: ansi_c_str = "\e[A"; break; diff --git a/userspace/programs/Shell/main.cpp b/userspace/programs/Shell/main.cpp index 1d8fbf03..d016a635 100644 --- a/userspace/programs/Shell/main.cpp +++ b/userspace/programs/Shell/main.cpp @@ -892,6 +892,16 @@ int main(int argc, char** argv) putchar('\n'); clean_exit(0); break; + case '\x7F': // delete + if (col < buffers[index].size()) + { + buffers[index].remove(col); + while (col < buffers[index].size() && (buffers[index][col] & 0xC0) == 0x80) + buffers[index].remove(col); + printf("\e[s%s \e[u", buffers[index].data() + col); + fflush(stdout); + } + break; case '\n': putchar('\n'); if (!buffers[index].empty())