Pass escape if in command mode.

I was working on integrating your work into another project, and this was pretty much the only change I had to make to the body of your code. It allows the handling of `ESCAPE` to be shared between the two components.

Any chance you might merge it?