diff --git a/src/drivers/keyboard.c b/src/drivers/keyboard.c index 1453bcd..2631449 100644 --- a/src/drivers/keyboard.c +++ b/src/drivers/keyboard.c @@ -1,9 +1,6 @@ #include "keyboard.h" #include "drivers.h" #include "interrupts.h" -#include "kprintf.h" -#include "shell.h" -#include "string.h" #include "terminal.h" #include #include @@ -15,15 +12,15 @@ static struct key_event new_input = {}; void keyboard_handler(struct registers *regs) { + (void)regs; new_input_indicator = true; new_input = terminal_getkey(); } struct key_event get_key(void) { - while (!new_input_indicator) ; new_input_indicator = false; return new_input; -} \ No newline at end of file +} diff --git a/src/shell/exec.c b/src/shell/exec.c index bc91aa1..1066406 100644 --- a/src/shell/exec.c +++ b/src/shell/exec.c @@ -82,14 +82,15 @@ static char *get_line(void) while (1) { ev = get_key(); - // kprintf("%d %d\n", ev.scan_code, ev.c); if (ev.c == '\n') break; char *buf = screen->line; i = strlen(screen->line); const size_t size = sizeof(screen->line); if (ev.scan_code) { - if (ev.scan_code == KEY_BACKSPACE && i) { + if (ev.scan_code == KEY_BACKSPACE) { + if (!i) + continue; buf[--i] = '\0'; move_cursor(LEFT); terminal_putchar(' '); @@ -106,6 +107,7 @@ static char *get_line(void) } kprintf("\n"); screen->line[i] = '\0'; + return screen->line; } void shell_init()