readline: Support odd backspace behaviour from serial
This addresses the problem with QEMU's serial input from terminal mentioned in issue #155
diff --git a/common/lib/readline.c b/common/lib/readline.c
index cd621bd4..12e6963b 100644
--- a/common/lib/readline.c
+++ b/common/lib/readline.c
@@ -182,6 +182,8 @@ again:
return input_sequence();
}
goto again;
+ case 0x7f:
+ return '\b';
}
return ret;
@@ -299,6 +301,10 @@ again:
kd.KeyState.KeyShiftState = 0;
}
+ if (kd.Key.ScanCode == 0x08) {
+ return '\b';
+ }
+
if (kd.Key.ScanCode == SCAN_ESC) {
gBS->CreateEvent(EVT_TIMER, TPL_CALLBACK, NULL, NULL, &events[1]);
