Adjusting position of caret