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

Function compareCollapsedMarkers

external/.scrollLibs.js:1409–1425  ·  view source on GitHub ↗
(a, b)

Source from the content-addressed store, hash-verified

1407 // spans is larger (and thus includes the other). Falls back to
1408 // comparing ids when the spans cover exactly the same range.
1409 function compareCollapsedMarkers(a, b) {
1410 var lenDiff = a.lines.length - b.lines.length
1411 if (lenDiff != 0) {
1412 return lenDiff
1413 }
1414 var aPos = a.find(),
1415 bPos = b.find()
1416 var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b)
1417 if (fromCmp) {
1418 return -fromCmp
1419 }
1420 var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b)
1421 if (toCmp) {
1422 return toCmp
1423 }
1424 return b.id - a.id
1425 }
1426
1427 // Find out whether a line ends or starts in a collapsed span. If
1428 // so, return the marker for that span.

Callers 3

collapsedSpanAtSideFunction · 0.85
collapsedSpanAroundFunction · 0.85
insertLineContentFunction · 0.85

Calls 4

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

Tested by

no test coverage detected