MCPcopy Index your code
hub / github.com/DHTMLX/gantt / removeReadOnlyRanges

Function removeReadOnlyRanges

samples/common/codehighlight/codemirror.js:1437–1463  ·  view source on GitHub ↗
(doc, from, to)

Source from the content-addressed store, hash-verified

1435
1436 // Used to 'clip' out readOnly ranges when making a change.
1437 function removeReadOnlyRanges(doc, from, to) {
1438 var markers = null;
1439 doc.iter(from.line, to.line + 1, function (line) {
1440 if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
1441 var mark = line.markedSpans[i].marker;
1442 if (mark.readOnly && (!markers || indexOf(markers, mark) == -1))
1443 { (markers || (markers = [])).push(mark); }
1444 } }
1445 });
1446 if (!markers) { return null }
1447 var parts = [{from: from, to: to}];
1448 for (var i = 0; i < markers.length; ++i) {
1449 var mk = markers[i], m = mk.find(0);
1450 for (var j = 0; j < parts.length; ++j) {
1451 var p = parts[j];
1452 if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) { continue }
1453 var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to);
1454 if (dfrom < 0 || !mk.inclusiveLeft && !dfrom)
1455 { newParts.push({from: p.from, to: m.from}); }
1456 if (dto > 0 || !mk.inclusiveRight && !dto)
1457 { newParts.push({from: m.to, to: p.to}); }
1458 parts.splice.apply(parts, newParts);
1459 j += newParts.length - 3;
1460 }
1461 }
1462 return parts
1463 }
1464
1465 // Connect or disconnect spans from a line.
1466 function detachMarkedSpans(line) {

Callers 1

makeChangeFunction · 0.85

Calls 2

indexOfFunction · 0.85
cmpFunction · 0.85

Tested by

no test coverage detected