bug fixes in cursor positioning and wrapping cache invalidation.
Merge commit 'dcda14c9ea50790bc9eaff8627d231740390596a' into TextboxPullRequest