MCPcopy Index your code
hub / github.com/csev/py4e / adjustView

Function adjustView

tools/pythonauto/static/codemirrorepl/codemirror.js:2147–2164  ·  view source on GitHub ↗
(cm, from, to)

Source from the content-addressed store, hash-verified

2145 // Force the view to cover a given range, adding empty view element
2146 // or clipping off existing ones as needed.
2147 function adjustView(cm, from, to) {
2148 var display = cm.display, view = display.view;
2149 if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {
2150 display.view = buildViewArray(cm, from, to);
2151 display.viewFrom = from;
2152 } else {
2153 if (display.viewFrom > from)
2154 display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view);
2155 else if (display.viewFrom < from)
2156 display.view = display.view.slice(findViewIndex(cm, from));
2157 display.viewFrom = from;
2158 if (display.viewTo < to)
2159 display.view = display.view.concat(buildViewArray(cm, display.viewTo, to));
2160 else if (display.viewTo > to)
2161 display.view = display.view.slice(0, findViewIndex(cm, to));
2162 }
2163 display.viewTo = to;
2164 }
2165
2166 // Count the number of lines in the view whose DOM representation is
2167 // out of date (or nonexistent).

Callers 1

updateDisplayInnerFunction · 0.85

Calls 3

buildViewArrayFunction · 0.85
findViewIndexFunction · 0.85
sliceMethod · 0.80

Tested by

no test coverage detected