Add timeout in ReadKey for event processing

The pipeline thread is blocked when PSReadline is running.
When the pipeline thread is blocked, PowerShell won't process
any events.

I added a timeout of 300ms and check for event subscribers,
if there are any, then run a bit of useless PowerShell so that
the PowerShell engine will get a chance to process events.

Fixes #133.
Remember script block for custom key bindings

For various reasons, we may need to know that a key binding
came from a script block so that is now saved in the key binding.
Tweak yielding for event processing slightly

Based on feedback from Lee, the conditions under which
we need to pulse the pipeline can be even more restrictive
and a more minimal "useless bit of script" can be used.
Reset console mode for calls to external code

For an unknown reason - SetConsoleMode calls fail when setting certain
modes.  One such case is when PowerShell calls SetConsoleMode in it's
implementation of PSHostRawUserInterface.ReadKey.

PowerTab calls this method - and it's possible that other custom
key handlers might want to use that api, so I will reset the console
mode to what it was before calling PSReadline for the duration of
the external code (tab completion or custom handlers) and reset it
when the external code completes.

Fixes #125.