about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYour Name <you@example.com>2020-06-24 20:21:37 +0200
committerYour Name <you@example.com>2020-06-24 20:21:37 +0200
commit8f45cf6ad06dc4efed7b7070cf755ed9d6ad1eea (patch)
tree3e9cd4a6a62de975617b3f1324822cc209b61a90
parentModified TODO (diff)
downloadpOS-8f45cf6ad06dc4efed7b7070cf755ed9d6ad1eea.tar.gz
pOS-8f45cf6ad06dc4efed7b7070cf755ed9d6ad1eea.tar.bz2
pOS-8f45cf6ad06dc4efed7b7070cf755ed9d6ad1eea.zip
Base: added tty handling of \b and \r
-rw-r--r--src/pOS/arch/x86/kernel/drivers/keyboard/kbbuf.cpp6
-rw-r--r--src/pOS/arch/x86/kernel/tty.cpp9
2 files changed, 10 insertions, 5 deletions
diff --git a/src/pOS/arch/x86/kernel/drivers/keyboard/kbbuf.cpp b/src/pOS/arch/x86/kernel/drivers/keyboard/kbbuf.cpp
index ceac96b..0892865 100644
--- a/src/pOS/arch/x86/kernel/drivers/keyboard/kbbuf.cpp
+++ b/src/pOS/arch/x86/kernel/drivers/keyboard/kbbuf.cpp
@@ -19,13 +19,10 @@ int KB_BUF::scan(unsigned char code)
 
   switch(code)
   {
+  /* IMPLEMENT WITH SIG CODES */
     case ESC:
         break;
 
-    case BACKSPACE:
-        TTY::tty_delete(1);
-        break;
-
     case UP_ARROW:
         if(shifted)
             TTY::tty_scroll(+1);
@@ -47,6 +44,7 @@ int KB_BUF::scan(unsigned char code)
         else
             TTY::tty_cursor_move(0, +1);
         break;
+    /* IMPLEMENT WITH SIG CODES */
 
     case LSHIFT_PRESS:
     case RSHIFT_PRESS:
diff --git a/src/pOS/arch/x86/kernel/tty.cpp b/src/pOS/arch/x86/kernel/tty.cpp
index fc796bd..f82fd5e 100644
--- a/src/pOS/arch/x86/kernel/tty.cpp
+++ b/src/pOS/arch/x86/kernel/tty.cpp
@@ -81,7 +81,14 @@ int TTY::tty_putentryat(unsigned char c, uint8_t color, size_t x, size_t y)
     {
         tty_x += TAB_INDENTATION;
         tty_map[x][y] = VGA::vga_entry(' ', color);
-    } //add \r, delete etc
+    }
+    else if(c == '\b')
+    {
+        TTY::tty_delete(1);
+        tty_x--;
+    }
+    else if(c == '\r')
+        tty_x = 0;
     else
         tty_map[x][y] = VGA::vga_entry(c, color);