I just set up a new computer, and as usual had to alter the settings in
xterm in order to make the delete keys work properly. (Ctrl-H sends
^H, backspace sends
^?, delete sends
^[[3~. This is, of course, the objectively correct way to do it.) While the default xterm settings are problematic, in this setup everything works fine, at least on xterm's end.
The problem is that, for some reason, the
stty settings in an xterm are always set to
erase = ^H. As well as messing things up in non-readline standard input, this also makes
tmux begin silently translating
^? in its windows, which makes things like emacs rather painful.
I have no idea why
stty is set this way. It isn't the default setting; typing
stty alone to display differences from default shows the
erase = ^H; line, and manually typing
stty erase ^? removes this line. (This also fixes the issues with stdin and tmux.) However, typing this in every terminal I start is tedious, and while I could put it in
.bashrc or something, this strikes me as not being the right way to do it.
What is it that causes
stty to use this particular incorrect, non-default setting? And how can I make it stop?