MCPcopy Create free account
hub / github.com/TruthHun/BookStack / mapFromLineView

Function mapFromLineView

static/mergely/lib/codemirror.js:2558–2567  ·  view source on GitHub ↗
(lineView, line, lineN)

Source from the content-addressed store, hash-verified

2556 // measurement cache for the given line number. (A line view might
2557 // contain multiple lines when collapsed ranges are present.)
2558 function mapFromLineView(lineView, line, lineN) {
2559 if (lineView.line == line)
2560 return {map: lineView.measure.map, cache: lineView.measure.cache};
2561 for (var i = 0; i < lineView.rest.length; i++)
2562 if (lineView.rest[i] == line)
2563 return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]};
2564 for (var i = 0; i < lineView.rest.length; i++)
2565 if (lineNo(lineView.rest[i]) > lineN)
2566 return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i], before: true};
2567 }
2568
2569 // Render a line into the hidden node display.externalMeasured. Used
2570 // when measurement is needed for a line that's not in the viewport.

Callers 2

posToDOMFunction · 0.70
prepareMeasureForLineFunction · 0.70

Calls 1

lineNoFunction · 0.70

Tested by

no test coverage detected