Fix walking caret bug

white-space css prop must be set to pre-wrap to keep trailing spaces
fixes #1766