Fix bug causing spaces to sometimes disappear from pasted text. #325