delete method

BidiRope delete(
  1. int start,
  2. int end
)

Implementation

BidiRope delete(int start, int end) {
  if (start < 0 || start > length) {
    throw RangeError.range(start, 0, length, 'start');
  }

  if (end < 0 || end > length) {
    throw RangeError.range(end, 0, length, 'end');
  }

  if (start > end) {
    throw RangeError('start must be less than or equal to end');
  }

  if (start == end) {
    return this;
  }

  final newRope = _rope.delete(start, end);
  final newText = newRope.toString();
  final containsRtl = BidirectionalText.containsRtl(newText);

  return BidiRope._(newRope, containsRtl);
}