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

Function removeReadOnlyRanges

tools/pythonauto/static/codemirror/codemirror.js:4196–4222  ·  view source on GitHub ↗
(doc, from, to)

Source from the content-addressed store, hash-verified

4194 }
4195
4196 function removeReadOnlyRanges(doc, from, to) {
4197 var markers = null;
4198 doc.iter(from.line, to.line + 1, function(line) {
4199 if (line.markedSpans) for (var i = 0; i < line.markedSpans.length; ++i) {
4200 var mark = line.markedSpans[i].marker;
4201 if (mark.readOnly && (!markers || indexOf(markers, mark) == -1))
4202 (markers || (markers = [])).push(mark);
4203 }
4204 });
4205 if (!markers) return null;
4206 var parts = [{from: from, to: to}];
4207 for (var i = 0; i < markers.length; ++i) {
4208 var mk = markers[i], m = mk.find();
4209 for (var j = 0; j < parts.length; ++j) {
4210 var p = parts[j];
4211 if (posLess(p.to, m.from) || posLess(m.to, p.from)) continue;
4212 var newParts = [j, 1];
4213 if (posLess(p.from, m.from) || !mk.inclusiveLeft && posEq(p.from, m.from))
4214 newParts.push({from: p.from, to: m.from});
4215 if (posLess(m.to, p.to) || !mk.inclusiveRight && posEq(p.to, m.to))
4216 newParts.push({from: m.to, to: p.to});
4217 parts.splice.apply(parts, newParts);
4218 j += newParts.length - 1;
4219 }
4220 }
4221 return parts;
4222 }
4223
4224 function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0; }
4225 function extraRight(marker) { return marker.inclusiveRight ? 1 : 0; }

Callers 1

makeChangeFunction · 0.70

Calls 4

indexOfFunction · 0.70
posLessFunction · 0.70
posEqFunction · 0.70
findMethod · 0.45

Tested by

no test coverage detected