MCPcopy Create free account
hub / github.com/sql-js/sql.js / conflictingCollapsedRange

Function conflictingCollapsedRange

GUI/codemirror/lib/codemirror.js:5380–5394  ·  view source on GitHub ↗
(doc, lineNo, from, to, marker)

Source from the content-addressed store, hash-verified

5378 // overlaps (covers the start or end, but not both) of a new span.
5379 // Such overlap is not allowed.
5380 function conflictingCollapsedRange(doc, lineNo, from, to, marker) {
5381 var line = getLine(doc, lineNo);
5382 var sps = sawCollapsedSpans && line.markedSpans;
5383 if (sps) for (var i = 0; i < sps.length; ++i) {
5384 var sp = sps[i];
5385 if (!sp.marker.collapsed) continue;
5386 var found = sp.marker.find(0);
5387 var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);
5388 var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);
5389 if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) continue;
5390 if (fromCmp <= 0 && (cmp(found.to, from) || extraRight(sp.marker) - extraLeft(marker)) > 0 ||
5391 fromCmp >= 0 && (cmp(found.from, to) || extraLeft(sp.marker) - extraRight(marker)) < 0)
5392 return true;
5393 }
5394 }
5395
5396 // A visual line is a line as drawn on the screen. Folding, for
5397 // example, can cause multiple logical lines to appear on the same

Callers 1

markTextFunction · 0.85

Calls 3

getLineFunction · 0.85
extraLeftFunction · 0.85
extraRightFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…