From 29d8c2eebbce0274a50558bffc94099083a2cb16 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Wed, 30 Sep 2009 22:32:50 -0400 Subject: [PATCH] Handle backspace on serial input and output better. Better solutions are welcome. --- console.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/console.c b/console.c index f7a6590..16d0e7a 100644 --- a/console.c +++ b/console.c @@ -163,7 +163,12 @@ consputc(int c) ; } - uartputc(c); + if (c == BACKSPACE) { + uartputc('\b'); + uartputc(' '); + uartputc('\b'); + } else + uartputc(c); cgaputc(c); } @@ -198,6 +203,7 @@ consoleintr(int (*getc)(void)) } break; case C('H'): // Backspace + case '\x7f': if(input.e != input.w){ input.e--; consputc(BACKSPACE);