MCPcopy
hub / github.com/DHTMLX/gantt / conflictingCollapsedRange

Function conflictingCollapsedRange

samples/common/codehighlight/codemirror.js:1527–1541  ·  view source on GitHub ↗
(doc, lineNo, from, to, marker)

Source from the content-addressed store, hash-verified

1525 // overlaps (covers the start or end, but not both) of a new span.
1526 // Such overlap is not allowed.
1527 function conflictingCollapsedRange(doc, lineNo, from, to, marker) {
1528 var line = getLine(doc, lineNo);
1529 var sps = sawCollapsedSpans && line.markedSpans;
1530 if (sps) { for (var i = 0; i < sps.length; ++i) {
1531 var sp = sps[i];
1532 if (!sp.marker.collapsed) { continue }
1533 var found = sp.marker.find(0);
1534 var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);
1535 var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);
1536 if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue }
1537 if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||
1538 fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))
1539 { return true }
1540 } }
1541 }
1542
1543 // A visual line is a line as drawn on the screen. Folding, for
1544 // example, can cause multiple logical lines to appear on the same

Callers 1

markTextFunction · 0.85

Calls 4

getLineFunction · 0.85
cmpFunction · 0.85
extraLeftFunction · 0.85
extraRightFunction · 0.85

Tested by

no test coverage detected