diff --git a/src/scrn.c b/src/scrn.c index 459a8a3..7f3cf5a 100644 --- a/src/scrn.c +++ b/src/scrn.c @@ -86,6 +86,8 @@ void putch(unsigned char c) if(c == 0x08) { if(csr_x != 0) csr_x--; + where = textmemptr + (csr_y * 80 + csr_x); + *where = ' ' | att; /* Character AND attributes: color */ } /* Handles a tab by incrementing the cursor's x, but only * to a point that will make it divisible by 8 */ diff --git a/src/shell.c b/src/shell.c index 4ff974d..13b1944 100644 --- a/src/shell.c +++ b/src/shell.c @@ -15,16 +15,34 @@ void run_shell() void key_pressed(unsigned char* character) { int len = strlen(commandbuffer); - commandbuffer[len] = character; - commandbuffer[len + 1] = '\0'; + //Check to see if the backspace has been pressed. + if(character != '\b') + { + //If it has not then simply add the character + //to the commandbuffer, and don't forget the null byte. + commandbuffer[len] = character; + commandbuffer[len + 1] = '\0'; + } + else + { + //Otherwise clear the last character from the command + //buffer. + commandbuffer[len - 1] = '\0'; + } + putch(character); } void execmd() { + if(strlen(commandbuffer) == 0) + { + puts("\n#>"); + return; + } if(strcmp(commandbuffer, "version")) { - puts("\nInteractive Shell Version 0.0.0.1\n"); + puts("\nInteractive Shell Version 0.0.1.2\n"); } else if(strcmp(commandbuffer,"cls")) { @@ -32,7 +50,9 @@ void execmd() } else { - puts("\nUnknown command\n"); + puts("\nUnknown command: "); + puts(commandbuffer); + puts(".\n"); } puts("#>"); commandbuffer[0] = '\0';