Fix multiple while loops from multipe _handle calls

This fixes a problem with multiple while loops in _handle being spawned
while emitting 'data' is blocking on editor UI. New calls to _handle
would pile up, each adding to _buf_in while previous calls to _handle
had not resolved. This would for example lead to multiple stomp prompts
in a row.