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

Function findViewIndex

static/editor.md/lib/codemirror/lib/codemirror.js:3219–3228  ·  view source on GitHub ↗
(cm, n)

Source from the content-addressed store, hash-verified

3217 // Find the view element corresponding to a given line. Return null
3218 // when the line isn't visible.
3219 function findViewIndex(cm, n) {
3220 if (n >= cm.display.viewTo) return null;
3221 n -= cm.display.viewFrom;
3222 if (n < 0) return null;
3223 var view = cm.display.view;
3224 for (var i = 0; i < view.length; i++) {
3225 n -= view[i].size;
3226 if (n < 0) return i;
3227 }
3228 }
3229
3230 function viewCuttingPoint(cm, oldN, newN, dir) {
3231 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