correct caret position referencing for touch devices