splitImmutable method
Both halves share structure with this rope. position must not be in
the middle of a surrogate pair.
Implementation
(Rope, Rope) splitImmutable(int position) {
if (position < 0 || position > length) {
throw RangeError('Invalid position: $position for length $length');
}
final left = copy()..delete(position, length);
final right = copy()..delete(0, position);
left.setSelection(selection);
right.setSelection(selection);
return (left, right);
}