331
return rawChanges;
332
}
334
>
const result = [rawChanges[0]];
335
>
let prevChange = result[0];
336
>
337
>
for (let i = 1, len = rawChanges.length; i < len; i++) {
338
>
const currChange = rawChanges[i];
339
>
340
>
const originalMatchingLength = currChange.originalStart - (prevChange.originalStart + prevChange.originalLength);
341
>
const modifiedMatchingLength = currChange.modifiedStart - (prevChange.modifiedStart + prevChange.modifiedLength);
342
>
// Both of the above should be equal, but the continueProcessingPredicate may prevent this from being true
343
>
const matchingLength = Math.min(originalMatchingLength, modifiedMatchingLength);
344
>
345
>
if (matchingLength < MINIMUM_MATCHING_CHARACTER_LENGTH) {
346
// Merge the current change into the previous one
347
prevChange.originalLength = (currChange.originalStart + currChange.originalLength) - prevChange.originalStart;
348
prevChange.modifiedLength = (currChange.modifiedStart + currChange.modifiedLength) - prevChange.modifiedStart;
350
// Add the current change
351
result.push(currChange);
352
prevChange = currChange;
353
}
355
>
356
>
return result;
357
>
}
358
359
class LineChange implements ILineChange {