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

Function adjustView

GUI/codemirror/lib/codemirror.js:2161–2178  ·  view source on GitHub ↗
(cm, from, to)

Source from the content-addressed store, hash-verified

2159 // Force the view to cover a given range, adding empty view element
2160 // or clipping off existing ones as needed.
2161 function adjustView(cm, from, to) {
2162 var display = cm.display, view = display.view;
2163 if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {
2164 display.view = buildViewArray(cm, from, to);
2165 display.viewFrom = from;
2166 } else {
2167 if (display.viewFrom > from)
2168 display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view);
2169 else if (display.viewFrom < from)
2170 display.view = display.view.slice(findViewIndex(cm, from));
2171 display.viewFrom = from;
2172 if (display.viewTo < to)
2173 display.view = display.view.concat(buildViewArray(cm, display.viewTo, to));
2174 else if (display.viewTo > to)
2175 display.view = display.view.slice(0, findViewIndex(cm, to));
2176 }
2177 display.viewTo = to;
2178 }
2179
2180 // Count the number of lines in the view whose DOM representation is
2181 // out of date (or nonexistent).

Callers 1

updateDisplayInnerFunction · 0.85

Calls 2

buildViewArrayFunction · 0.85
findViewIndexFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…