Anatomy of a terminal emulator