Add support for clearing the count repetitions by pressing Esc

Moved the check for pressing Esc to before where the command event keys are processed - and it will clear out the number of repetitions entered.

This was going to be part of implementing F and f as commands: Both of which require you to be able to enter addtional characters after the command.  

First pass didn't work so well, so here is just the escape part.
I prefer to avoid named return variables unless necessary for clarity