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

Function computeIntact

tools/pythonauto/static/codemirrorepl/codemirrorepl.js:1223–1244  ·  view source on GitHub ↗
(intact, changes)

Source from the content-addressed store, hash-verified

1221 }
1222
1223 function computeIntact(intact, changes) {
1224 for (var i = 0, l = changes.length || 0; i < l; ++i) {
1225 var change = changes[i], intact2 = [], diff = change.diff || 0;
1226 for (var j = 0, l2 = intact.length; j < l2; ++j) {
1227 var range = intact[j];
1228 if (change.to <= range.from && change.diff)
1229 intact2.push({from: range.from + diff, to: range.to + diff,
1230 domStart: range.domStart});
1231 else if (change.to <= range.from || change.from >= range.to)
1232 intact2.push(range);
1233 else {
1234 if (change.from > range.from)
1235 intact2.push({from: range.from, to: change.from, domStart: range.domStart});
1236 if (change.to < range.to)
1237 intact2.push({from: change.to + diff, to: range.to + diff,
1238 domStart: range.domStart + (change.to - range.from)});
1239 }
1240 }
1241 intact = intact2;
1242 }
1243 return intact;
1244 }
1245
1246 function patchDisplay(from, to, intact) {
1247 // The first pass removes the DOM nodes that aren't intact.

Callers 1

updateDisplayFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected