From 6aab7de68496d8a976703c81f16eaead2d4d3592 Mon Sep 17 00:00:00 2001 From: Joel Spadin Date: Fri, 6 Mar 2026 09:33:54 -0600 Subject: [PATCH] fix: Handle backspace in Bash Bash returns the ASCII code for DELETE instead of BACKSPACE when pressing backspace. Added a special case for that. --- zmk/terminal.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/zmk/terminal.py b/zmk/terminal.py index 06cd015..fc58cb9 100644 --- a/zmk/terminal.py +++ b/zmk/terminal.py @@ -158,7 +158,12 @@ def read_key() -> bytes: Special keys such as arrow keys return xterm or vt escape sequences. """ with disable_echo(): - return os.read(sys.stdin.fileno(), 4) + key = os.read(sys.stdin.fileno(), 4) + + if key == b"\x7f": # Bash uses DELETE instead of BACKSPACE + return BACKSPACE + + return key def get_cursor_pos() -> tuple[int, int]: