Function TextRange.isInsideOrNext

returns true if position is inside this range or right after this range

bool isInsideOrNext(
  TextPosition p
) const;