Function TextRange.isInside

returns true if position is inside this range

bool isInside(
  TextPosition p
) const;