MCPcopy Create free account
hub / github.com/breck7/scroll / conflictingCollapsedRange

Function conflictingCollapsedRange

external/.scrollLibs.js:1466–1489  ·  view source on GitHub ↗
(doc, lineNo$$1, from, to, marker)

Source from the content-addressed store, hash-verified

1464 // overlaps (covers the start or end, but not both) of a new span.
1465 // Such overlap is not allowed.
1466 function conflictingCollapsedRange(doc, lineNo$$1, from, to, marker) {
1467 var line = getLine(doc, lineNo$$1)
1468 var sps = sawCollapsedSpans && line.markedSpans
1469 if (sps) {
1470 for (var i = 0; i < sps.length; ++i) {
1471 var sp = sps[i]
1472 if (!sp.marker.collapsed) {
1473 continue
1474 }
1475 var found = sp.marker.find(0)
1476 var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker)
1477 var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker)
1478 if ((fromCmp >= 0 && toCmp <= 0) || (fromCmp <= 0 && toCmp >= 0)) {
1479 continue
1480 }
1481 if (
1482 (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0)) ||
1483 (fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))
1484 ) {
1485 return true
1486 }
1487 }
1488 }
1489 }
1490
1491 // A visual line is a line as drawn on the screen. Folding, for
1492 // example, can cause multiple logical lines to appear on the same

Callers 1

markTextFunction · 0.85

Calls 5

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

Tested by

no test coverage detected