bugfix in flush key
bugfix in flush key

1. only invalidate ui when some keys are processed
2. do not start_timeout if the last key is _Flush, otherwise it causes a dead loop
3. only send flush key when the queue is not empty

jonathanslenders/python-prompt-toolkit