:: commit f59a1eac0b40084cf5d2ce2e9090b4700da0375d

mintsuki <mintsuki@protonmail.com> — 2022-03-07 21:09

parents: af092292ea

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]);
 
tab: 248 wrap: offon