MCPcopy Create free account
hub / github.com/sql-js/sql.js / findViewIndex

Function findViewIndex

GUI/codemirror/lib/codemirror.js:2125–2134  ·  view source on GitHub ↗
(cm, n)

Source from the content-addressed store, hash-verified

2123 // Find the view element corresponding to a given line. Return null
2124 // when the line isn't visible.
2125 function findViewIndex(cm, n) {
2126 if (n >= cm.display.viewTo) return null;
2127 n -= cm.display.viewFrom;
2128 if (n < 0) return null;
2129 var view = cm.display.view;
2130 for (var i = 0; i < view.length; i++) {
2131 n -= view[i].size;
2132 if (n < 0) return i;
2133 }
2134 }
2135
2136 function viewCuttingPoint(cm, oldN, newN, dir) {
2137 var index = findViewIndex(cm, oldN), diff, view = cm.display.view;

Callers 4

findViewForLineFunction · 0.85
regLineChangeFunction · 0.85
viewCuttingPointFunction · 0.85
adjustViewFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…