ncurses icon indicating copy to clipboard operation
ncurses copied to clipboard

Add potential keycode for backspace keypress

Open daviscodesbugs opened this issue 4 years ago • 0 comments

I was running into some weirdness while running the input example where pressing Backspace on my keyboard resulted in ^? being printed. After doing some digging, I found that the value in key.cr is 0o047 which is truly the ASCII control code for backspace and I can get Backspace to print in the example with Ctrl + H on my keyboard.

After further reading, I realized the terminal is getting the ASCII control code for delete (0o117) when I press Backspace on my keyboard. This is common on modern systems as noted here. Since there is already a Delete in key.cr (the "del" key on the keyboard), I added Erase since some keyboards have that label on the backspace key.

You can see the control codes and their corresponding values here

daviscodesbugs avatar Oct 18 '21 20:10 daviscodesbugs