With the terminal in raw mode (~ICANON
), the BkSp key will output the byte 0x7f
, which is not interpreted as a backspace by the terminal. (This is so that it can be distinguished from the keystroke ^H.) If you want this keystroke to be interpreted by the terminal as a backspace, you will need to:
- Disable echo on the terminal (
~ECHO
), then - Echo back most characters as they are input, but echo
0x7f
as0x08
(\b
). (You will also probably need to echo\n
as\r\n
.)