Prevent excessive refresh of REPL state

With the recent libuv async change and depending on the terminal emulator
there was really bad flickering on some systems everytime the input area was
refreshed. This fixes that by writing the entire refresh at once which most terminal emulators will draw in one go. There is still a small nit that we do two redraws when exiting from search, but that will have to be done another day.