Remove invisible whitespace from the beginning of the text and control the caret position while deleting.