fix caret position on focusing