Prevent crash on Windows when writing many characters at once.
Prevent crash on Windows when writing many characters at once.

A couple cases which are known to have triggered this are:
- Entering a long (>2^15) input line
- Tab-completing a folder containing many files, with completionPaging:False

judah/haskeline,ghc/packages-haskeline,ghc/packages-haskeline,leroux/packages-haskeline,judah/haskeline