Get caret postion and offset from text field