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

Function adjustView

static/mergely/lib/codemirror.js:3365–3382  ·  view source on GitHub ↗
(cm, from, to)

Source from the content-addressed store, hash-verified

3363 // Force the view to cover a given range, adding empty view element
3364 // or clipping off existing ones as needed.
3365 function adjustView(cm, from, to) {
3366 var display = cm.display, view = display.view;
3367 if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {
3368 display.view = buildViewArray(cm, from, to);
3369 display.viewFrom = from;
3370 } else {
3371 if (display.viewFrom > from)
3372 display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view);
3373 else if (display.viewFrom < from)
3374 display.view = display.view.slice(findViewIndex(cm, from));
3375 display.viewFrom = from;
3376 if (display.viewTo < to)
3377 display.view = display.view.concat(buildViewArray(cm, display.viewTo, to));
3378 else if (display.viewTo > to)
3379 display.view = display.view.slice(0, findViewIndex(cm, to));
3380 }
3381 display.viewTo = to;
3382 }
3383
3384 // Count the number of lines in the view whose DOM representation is
3385 // out of date (or nonexistent).

Callers 1

updateDisplayIfNeededFunction · 0.70

Calls 2

buildViewArrayFunction · 0.70
findViewIndexFunction · 0.70

Tested by

no test coverage detected