Here are a couple of fixes I needed to use Nethack with the terminal emulator. First, the backspace character shouldn't erase the character at the current position.
Second--and I'm less sure about this--I had to make a carriage return move to the beginning of the current line and a linefeed move to the same column on the next line. This will work whenever the terminal receives \r\n for newlines but not when it only gets \n. My change seems to match what Nethack expects and what the ANSI terminal spec says. However, it breaks the test in ANSI.py and I don't know if it will break anything else.