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

Function mapFromLineView

external/.scrollLibs.js:3606–3620  ·  view source on GitHub ↗
(lineView, line, lineN)

Source from the content-addressed store, hash-verified

3604 // measurement cache for the given line number. (A line view might
3605 // contain multiple lines when collapsed ranges are present.)
3606 function mapFromLineView(lineView, line, lineN) {
3607 if (lineView.line == line) {
3608 return { map: lineView.measure.map, cache: lineView.measure.cache }
3609 }
3610 for (var i = 0; i < lineView.rest.length; i++) {
3611 if (lineView.rest[i] == line) {
3612 return { map: lineView.measure.maps[i], cache: lineView.measure.caches[i] }
3613 }
3614 }
3615 for (var i$1 = 0; i$1 < lineView.rest.length; i$1++) {
3616 if (lineNo(lineView.rest[i$1]) > lineN) {
3617 return { map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true }
3618 }
3619 }
3620 }
3621
3622 // Render a line into the hidden node display.externalMeasured. Used
3623 // when measurement is needed for a line that's not in the viewport.

Callers 2

prepareMeasureForLineFunction · 0.85
posToDOMFunction · 0.85

Calls 1

lineNoFunction · 0.85

Tested by

no test coverage detected