I telnet to an HP switch from my (xterm|gnome-terminal). Exit telnet. That breaks the behaviour of the terminal. (If you don't have a HP switch to telnet to, one can
cat this file in a terminal instead).
Now type a very long command (more than one line, and see that the second line doesn't wrap down to the next line, but "stays in the current line". Which makes it impossible to edit prior commands or use the terminal for anything longer than one line.
cat filewithlonglines.txt or
git log -p only shows the first 80 chars of lines longer than 80 chars.
reset doesn't work.
stty -g > stty.works, run telnet,
stty $(stty.works) restores changed
stty settings, but behaviour is still broken.
I have to close the terminal and start a new one. :-(
What can I do besides
stty save/restore to fix my broken terminals after a telnet?
EDIT: I've discovered that if I use
screen like in one of these commands:
screen bash -c "cat hptelnet.escape ; bash"
screen telnet hpswitch
Then my terminal still works properly when screen exits. So a workaround is to put screen in front of the command that messes up my terminal, but I'd still like to know how to recover a terminal that already has been messed up...