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

Function shiftDoc

tools/pythonauto/static/codemirrorepl/codemirror.js:3366–3373  ·  view source on GitHub ↗
(doc, distance)

Source from the content-addressed store, hash-verified

3364 // Sub-views need their line numbers shifted when text is added
3365 // above or below them in the parent document.
3366 function shiftDoc(doc, distance) {
3367 doc.first += distance;
3368 doc.sel = new Selection(map(doc.sel.ranges, function(range) {
3369 return new Range(Pos(range.anchor.line + distance, range.anchor.ch),
3370 Pos(range.head.line + distance, range.head.ch));
3371 }), doc.sel.primIndex);
3372 if (doc.cm) regChange(doc.cm, doc.first, doc.first - distance, distance);
3373 }
3374
3375 // More lower-level change function, handling only a single document
3376 // (not linked ones).

Callers 1

makeChangeSingleDocFunction · 0.70

Calls 3

PosFunction · 0.85
mapFunction · 0.70
regChangeFunction · 0.70

Tested by

no test coverage detected