MCPcopy Index your code
hub / github.com/DHTMLX/gantt / shiftDoc

Function shiftDoc

samples/common/codehighlight/codemirror.js:5376–5388  ·  view source on GitHub ↗
(doc, distance)

Source from the content-addressed store, hash-verified

5374 // Sub-views need their line numbers shifted when text is added
5375 // above or below them in the parent document.
5376 function shiftDoc(doc, distance) {
5377 if (distance == 0) { return }
5378 doc.first += distance;
5379 doc.sel = new Selection(map(doc.sel.ranges, function (range) { return new Range(
5380 Pos(range.anchor.line + distance, range.anchor.ch),
5381 Pos(range.head.line + distance, range.head.ch)
5382 ); }), doc.sel.primIndex);
5383 if (doc.cm) {
5384 regChange(doc.cm, doc.first, doc.first - distance, distance);
5385 for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++)
5386 { regLineChange(doc.cm, l, "gutter"); }
5387 }
5388 }
5389
5390 // More lower-level change function, handling only a single document
5391 // (not linked ones).

Callers 1

makeChangeSingleDocFunction · 0.85

Calls 4

mapFunction · 0.85
PosFunction · 0.85
regChangeFunction · 0.85
regLineChangeFunction · 0.85

Tested by

no test coverage detected