MCPcopy
hub / github.com/csev/py4e / conflictingCollapsedRange

Function conflictingCollapsedRange

tools/pythonauto/static/codemirrorepl/codemirror.js:5337–5351  ·  view source on GitHub ↗
(doc, lineNo, from, to, marker)

Source from the content-addressed store, hash-verified

5335 // overlaps (covers the start or end, but not both) of a new span.
5336 // Such overlap is not allowed.
5337 function conflictingCollapsedRange(doc, lineNo, from, to, marker) {
5338 var line = getLine(doc, lineNo);
5339 var sps = sawCollapsedSpans && line.markedSpans;
5340 if (sps) for (var i = 0; i < sps.length; ++i) {
5341 var sp = sps[i];
5342 if (!sp.marker.collapsed) continue;
5343 var found = sp.marker.find(0);
5344 var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);
5345 var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);
5346 if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) continue;
5347 if (fromCmp <= 0 && (cmp(found.to, from) || extraRight(sp.marker) - extraLeft(marker)) > 0 ||
5348 fromCmp >= 0 && (cmp(found.from, to) || extraLeft(sp.marker) - extraRight(marker)) < 0)
5349 return true;
5350 }
5351 }
5352
5353 // A visual line is a line as drawn on the screen. Folding, for
5354 // example, can cause multiple logical lines to appear on the same

Callers 1

markTextFunction · 0.70

Calls 5

cmpFunction · 0.85
getLineFunction · 0.70
extraLeftFunction · 0.70
extraRightFunction · 0.70
findMethod · 0.45

Tested by

no test coverage detected