Cleanup the keyboard input routine.
Optimize for ANSI.
delayprompt now works for Meta key under ANSI.