MCPcopy
hub / github.com/witheve/Eve / conflictingCollapsedRange

Function conflictingCollapsedRange

src/codemirror.js:6571–6585  ·  view source on GitHub ↗
(doc, lineNo, from, to, marker)

Source from the content-addressed store, hash-verified

6569 // overlaps (covers the start or end, but not both) of a new span.
6570 // Such overlap is not allowed.
6571 function conflictingCollapsedRange(doc, lineNo, from, to, marker) {
6572 var line = getLine(doc, lineNo);
6573 var sps = sawCollapsedSpans && line.markedSpans;
6574 if (sps) for (var i = 0; i < sps.length; ++i) {
6575 var sp = sps[i];
6576 if (!sp.marker.collapsed) continue;
6577 var found = sp.marker.find(0);
6578 var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);
6579 var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);
6580 if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) continue;
6581 if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||
6582 fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))
6583 return true;
6584 }
6585 }
6586
6587 // A visual line is a line as drawn on the screen. Folding, for
6588 // example, can cause multiple logical lines to appear on the same

Callers 1

markTextFunction · 0.85

Calls 4

getLineFunction · 0.85
extraLeftFunction · 0.85
extraRightFunction · 0.85
findMethod · 0.65

Tested by

no test coverage detected