MCPcopy
hub / github.com/witheve/Eve / adjustView

Function adjustView

src/codemirror.js:3386–3403  ·  view source on GitHub ↗
(cm, from, to)

Source from the content-addressed store, hash-verified

3384 // Force the view to cover a given range, adding empty view element
3385 // or clipping off existing ones as needed.
3386 function adjustView(cm, from, to) {
3387 var display = cm.display, view = display.view;
3388 if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {
3389 display.view = buildViewArray(cm, from, to);
3390 display.viewFrom = from;
3391 } else {
3392 if (display.viewFrom > from)
3393 display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view);
3394 else if (display.viewFrom < from)
3395 display.view = display.view.slice(findViewIndex(cm, from));
3396 display.viewFrom = from;
3397 if (display.viewTo < to)
3398 display.view = display.view.concat(buildViewArray(cm, display.viewTo, to));
3399 else if (display.viewTo > to)
3400 display.view = display.view.slice(0, findViewIndex(cm, to));
3401 }
3402 display.viewTo = to;
3403 }
3404
3405 // Count the number of lines in the view whose DOM representation is
3406 // out of date (or nonexistent).

Callers 1

updateDisplayIfNeededFunction · 0.85

Calls 2

buildViewArrayFunction · 0.85
findViewIndexFunction · 0.85

Tested by

no test coverage detected