Adding TTY emulation.

I believe this will be 'good enough' for doppio, but I will need to do some testing before I'm sure.