MCPcopy Index your code
hub / github.com/csev/py4e / mergeOldSpans

Function mergeOldSpans

tools/pythonauto/static/codemirror/codemirror.js:4174–4194  ·  view source on GitHub ↗
(doc, change)

Source from the content-addressed store, hash-verified

4172 }
4173
4174 function mergeOldSpans(doc, change) {
4175 var old = getOldSpans(doc, change);
4176 var stretched = stretchSpansOverChange(doc, change);
4177 if (!old) return stretched;
4178 if (!stretched) return old;
4179
4180 for (var i = 0; i < old.length; ++i) {
4181 var oldCur = old[i], stretchCur = stretched[i];
4182 if (oldCur && stretchCur) {
4183 spans: for (var j = 0; j < stretchCur.length; ++j) {
4184 var span = stretchCur[j];
4185 for (var k = 0; k < oldCur.length; ++k)
4186 if (oldCur[k].marker == span.marker) continue spans;
4187 oldCur.push(span);
4188 }
4189 } else if (stretchCur) {
4190 old[i] = stretchCur;
4191 }
4192 }
4193 return old;
4194 }
4195
4196 function removeReadOnlyRanges(doc, from, to) {
4197 var markers = null;

Callers 1

makeChangeFromHistoryFunction · 0.70

Calls 2

getOldSpansFunction · 0.70
stretchSpansOverChangeFunction · 0.70

Tested by

no test coverage detected