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

Function compareCollapsedMarkers

tools/pythonauto/static/codemirrorepl/codemirror.js:5308–5317  ·  view source on GitHub ↗
(a, b)

Source from the content-addressed store, hash-verified

5306 // spans is larger (and thus includes the other). Falls back to
5307 // comparing ids when the spans cover exactly the same range.
5308 function compareCollapsedMarkers(a, b) {
5309 var lenDiff = a.lines.length - b.lines.length;
5310 if (lenDiff != 0) return lenDiff;
5311 var aPos = a.find(), bPos = b.find();
5312 var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b);
5313 if (fromCmp) return -fromCmp;
5314 var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b);
5315 if (toCmp) return toCmp;
5316 return b.id - a.id;
5317 }
5318
5319 // Find out whether a line ends or starts in a collapsed span. If
5320 // so, return the marker for that span.

Callers 2

collapsedSpanAtSideFunction · 0.70
insertLineContentFunction · 0.70

Calls 4

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

Tested by

no test coverage detected