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

Function adjustView

static/editor.md/lib/codemirror/lib/codemirror.js:3256–3273  ·  view source on GitHub ↗
(cm, from, to)

Source from the content-addressed store, hash-verified

3254 // Force the view to cover a given range, adding empty view element
3255 // or clipping off existing ones as needed.
3256 function adjustView(cm, from, to) {
3257 var display = cm.display, view = display.view;
3258 if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {
3259 display.view = buildViewArray(cm, from, to);
3260 display.viewFrom = from;
3261 } else {
3262 if (display.viewFrom > from)
3263 display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view);
3264 else if (display.viewFrom < from)
3265 display.view = display.view.slice(findViewIndex(cm, from));
3266 display.viewFrom = from;
3267 if (display.viewTo < to)
3268 display.view = display.view.concat(buildViewArray(cm, display.viewTo, to));
3269 else if (display.viewTo > to)
3270 display.view = display.view.slice(0, findViewIndex(cm, to));
3271 }
3272 display.viewTo = to;
3273 }
3274
3275 // Count the number of lines in the view whose DOM representation is
3276 // out of date (or nonexistent).

Callers 1

updateDisplayIfNeededFunction · 0.70

Calls 2

buildViewArrayFunction · 0.70
findViewIndexFunction · 0.70

Tested by

no test coverage detected