fix backspace

This commit is contained in:
xenia 2021-05-12 17:28:29 -04:00
parent 5bbd7372d1
commit 9b7e96ed6b
1 changed files with 13 additions and 3 deletions

View File

@ -95,6 +95,10 @@ class KeycodeHandler:
if byte == ESC_CHAR:
self.esc = True
return b""
# i'm not super sure why this translation is necessary
# idk if there's more translations that are necessary too
elif byte == b"\x7f":
return b"\x08"
return byte
@ -169,9 +173,15 @@ async def megacom_main(stdin: asyncio.StreamReader, stdout: asyncio.StreamWriter
if len(c) == 0:
continue
c = keycodes.process(c)
if len(c) == 0:
continue
if ctrl:
# stdout.write(f"\r\nin char: {c}\r\n".encode())
# await stdout.drain()
c = keycodes.process(c)
if len(c) == 0:
continue
# else:
# stdout.write(f"\r\nout char: {c}\r\n".encode())
# await stdout.drain()
pout.write(c)
await pout.drain()