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

Function findViewIndex

static/mergely/lib/codemirror.js:3328–3337  ·  view source on GitHub ↗
(cm, n)

Source from the content-addressed store, hash-verified

3326 // Find the view element corresponding to a given line. Return null
3327 // when the line isn't visible.
3328 function findViewIndex(cm, n) {
3329 if (n >= cm.display.viewTo) return null;
3330 n -= cm.display.viewFrom;
3331 if (n < 0) return null;
3332 var view = cm.display.view;
3333 for (var i = 0; i < view.length; i++) {
3334 n -= view[i].size;
3335 if (n < 0) return i;
3336 }
3337 }
3338
3339 function viewCuttingPoint(cm, oldN, newN, dir) {
3340 var index = findViewIndex(cm, oldN), diff, view = cm.display.view;

Callers 5

codemirror.jsFile · 0.70
findViewForLineFunction · 0.70
regLineChangeFunction · 0.70
viewCuttingPointFunction · 0.70
adjustViewFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected