: Sometimes my curser keys produce strange codes?
When the terminal is in application key mode the cursor keys
produce Esc O x and otherwise Esc [ x where x is one of A,B,C,D.
Certain programs put the terminal in application key mode;
if you kill them with kill -9, or if they crash, then the mode will
not be reset.
% echo -e '\033c'
resets all properties of the current VC. Just changing the application
key mode is done by
% echo -e '\033[?1h'
(set) and
% echo -e '\033[?1l'
(clear).