Fix backspace echo for terminals that send chr(127)

The input detection handled both chr(8) and chr(127) but the echo
logic only checked chr(8). Most modern terminals send chr(127) for
backspace, so the cursor never moved back visually.
This commit is contained in:
Jared Miller 2026-02-09 23:11:43 -05:00
parent 1b08c36b85
commit ec4e53b2d4
Signed by: shmup
GPG key ID: 22B5C6D66A38B06C

View file

@ -368,7 +368,7 @@ def _read_line(original_text=None, terminating_characters=None):
if char == "\r":
char_to_print = "\n"
elif char == _BACKSPACE_CHAR:
elif char in (_BACKSPACE_CHAR, _DELETE_CHAR):
char_to_print = f"{_BACKSPACE_CHAR} {_BACKSPACE_CHAR}"
else:
char_to_print = char