handling of ANSI terminals with Expect