MCPcopy Index your code
hub / github.com/ronreiter/interactive-tutorials / computeIntact

Function computeIntact

static/js/codemirror/codemirror.js:531–550  ·  view source on GitHub ↗
(intact, changes)

Source from the content-addressed store, hash-verified

529 }
530
531 function computeIntact(intact, changes) {
532 for (var i = 0, l = changes.length || 0; i < l; ++i) {
533 var change = changes[i], intact2 = [], diff = change.diff || 0;
534 for (var j = 0, l2 = intact.length; j < l2; ++j) {
535 var range = intact[j];
536 if (change.to <= range.from && change.diff) {
537 intact2.push({from: range.from + diff, to: range.to + diff});
538 } else if (change.to <= range.from || change.from >= range.to) {
539 intact2.push(range);
540 } else {
541 if (change.from > range.from)
542 intact2.push({from: range.from, to: change.from});
543 if (change.to < range.to)
544 intact2.push({from: change.to + diff, to: range.to + diff});
545 }
546 }
547 intact = intact2;
548 }
549 return intact;
550 }
551
552 function getDimensions(cm) {
553 var d = cm.display, left = {}, width = {};

Callers 1

updateDisplayInnerFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected