133
break;
134
}
135
>
// else we intersect, because the new end of edit1 is after or equal to our start
edit.ts
136
>
137
>
if (!firstIntersecting) {
138
>
firstIntersecting = r1;
139
>
}
140
>
lastIntersecting = r1;
141
>
edit1Queue.shift();
142
>
143
>
edit1ToEdit2 += r1.getNewLength() - r1.replaceRange.length;
144
>
}
145
146
if (!firstIntersecting) {
147
result.push(r2.delta(-edit1ToEdit2));
148
} else {
149
>
const newReplaceRangeStart = Math.min(firstIntersecting.replaceRange.start, r2.replaceRange.start - firstEdit1ToEdit2);
edit.ts
150
>
151
>
const prefixLength = r2.replaceRange.start - (firstIntersecting.replaceRange.start + firstEdit1ToEdit2);
152
>
if (prefixLength > 0) {
153
const prefix = firstIntersecting.slice(OffsetRange.emptyAt(newReplaceRangeStart), new OffsetRange(0, prefixLength));
154
result.push(prefix);
155
}
156
>
if (!lastIntersecting) {
edit.ts
157
throw new BugIndicatingError(`Invariant violation: lastIntersecting is undefined`);
158
}
159
>
const suffixLength = (lastIntersecting.replaceRange.endExclusive + edit1ToEdit2) - r2.replaceRange.endExclusive;
edit.ts
160
>
if (suffixLength > 0) {
161
const e = lastIntersecting.slice(
162
OffsetRange.ofStartAndLength(lastIntersecting.replaceRange.endExclusive, 0),