Add timeout to getchar, needed for escape sequences.
Use erase sequence instead of whitespace.