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

Function mapFromLineView

static/editor.md/lib/codemirror/lib/codemirror.js:2454–2463  ·  view source on GitHub ↗
(lineView, line, lineN)

Source from the content-addressed store, hash-verified

2452 // measurement cache for the given line number. (A line view might
2453 // contain multiple lines when collapsed ranges are present.)
2454 function mapFromLineView(lineView, line, lineN) {
2455 if (lineView.line == line)
2456 return {map: lineView.measure.map, cache: lineView.measure.cache};
2457 for (var i = 0; i < lineView.rest.length; i++)
2458 if (lineView.rest[i] == line)
2459 return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]};
2460 for (var i = 0; i < lineView.rest.length; i++)
2461 if (lineNo(lineView.rest[i]) > lineN)
2462 return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i], before: true};
2463 }
2464
2465 // Render a line into the hidden node display.externalMeasured. Used
2466 // 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