Calcurate markedRange on setMarkedText.