Improved white space handling so cursor moves with spaces.