221
if (edits1.replacements.length === 0) { return edits2; }
222
if (edits2.replacements.length === 0) { return edits1; }
224
>
const resultReplacements: TextReplacement[] = [];
225
>
226
>
let edit1Idx = 0;
227
>
let lastEdit1EndS0Line = 1;
228
>
let lastEdit1EndS0Col = 1;
229
>
230
>
let headSrcRangeStartLine = 0;
231
>
let headSrcRangeStartCol = 0;
232
>
let headSrcRangeEndLine = 0;
233
>
let headSrcRangeEndCol = 0;
234
>
let headText: string | null = null;
235
>
let headLengthLine = 0;
236
>
let headLengthCol = 0;
237
>
238
>
let headHasValue = false;
239
>
let headIsInfinite = false;
240
>
241
>
let currentPosInS1Line = 1;
242
>
let currentPosInS1Col = 1;
243
>
244
>
function ensureHead() {
245
>
if (headHasValue) { return; }
246
>
247
>
if (edit1Idx < edits1.replacements.length) {
248
>
const nextEdit = edits1.replacements[edit1Idx];
249
>
const nextEditStart = nextEdit.range.getStartPosition();
250
>
251
>
const gapIsEmpty = (lastEdit1EndS0Line === nextEditStart.lineNumber) && (lastEdit1EndS0Col === nextEditStart.column);
252
>
253
>
if (!gapIsEmpty) {
254
headSrcRangeStartLine = lastEdit1EndS0Line;
255
headSrcRangeStartCol = lastEdit1EndS0Col;