Prevent prompt interrupt

This is a fix for nathanielksmith/murepl#1. Essentially, it saves the user from having to retype their input whenever a new message arrives over the socket. However, I have only tested it using multiple browser tabs on the same machine, so switching back and forth between repls has given me little insight into how well this fix affects, say, a user who continues typing *while* the prompt is being replaced.