MCPcopy Create free account
hub / github.com/sql-js/sql.js / shiftDoc

Function shiftDoc

GUI/codemirror/lib/codemirror.js:3402–3409  ·  view source on GitHub ↗
(doc, distance)

Source from the content-addressed store, hash-verified

3400 // Sub-views need their line numbers shifted when text is added
3401 // above or below them in the parent document.
3402 function shiftDoc(doc, distance) {
3403 doc.first += distance;
3404 doc.sel = new Selection(map(doc.sel.ranges, function(range) {
3405 return new Range(Pos(range.anchor.line + distance, range.anchor.ch),
3406 Pos(range.head.line + distance, range.head.ch));
3407 }), doc.sel.primIndex);
3408 if (doc.cm) regChange(doc.cm, doc.first, doc.first - distance, distance);
3409 }
3410
3411 // More lower-level change function, handling only a single document
3412 // (not linked ones).

Callers 1

makeChangeSingleDocFunction · 0.85

Calls 2

mapFunction · 0.85
regChangeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…