MCPcopy Create free account
hub / github.com/ronreiter/interactive-tutorials / mergeOldSpans

Function mergeOldSpans

static/js/codemirror/codemirror.js:3654–3674  ·  view source on GitHub ↗
(doc, change)

Source from the content-addressed store, hash-verified

3652 }
3653
3654 function mergeOldSpans(doc, change) {
3655 var old = getOldSpans(doc, change);
3656 var stretched = stretchSpansOverChange(doc, change);
3657 if (!old) return stretched;
3658 if (!stretched) return old;
3659
3660 for (var i = 0; i < old.length; ++i) {
3661 var oldCur = old[i], stretchCur = stretched[i];
3662 if (oldCur && stretchCur) {
3663 spans: for (var j = 0; j < stretchCur.length; ++j) {
3664 var span = stretchCur[j];
3665 for (var k = 0; k < oldCur.length; ++k)
3666 if (oldCur[k].marker == span.marker) continue spans;
3667 oldCur.push(span);
3668 }
3669 } else if (stretchCur) {
3670 old[i] = stretchCur;
3671 }
3672 }
3673 return old;
3674 }
3675
3676 function removeReadOnlyRanges(doc, from, to) {
3677 var markers = null;

Callers 1

makeChangeFromHistoryFunction · 0.85

Calls 3

getOldSpansFunction · 0.85
stretchSpansOverChangeFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected