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

Function makeChangeSingleDoc

tools/pythonauto/static/codemirrorepl/codemirror.js:3377–3406  ·  view source on GitHub ↗
(doc, change, selAfter, spans)

Source from the content-addressed store, hash-verified

3375 // More lower-level change function, handling only a single document
3376 // (not linked ones).
3377 function makeChangeSingleDoc(doc, change, selAfter, spans) {
3378 if (doc.cm && !doc.cm.curOp)
3379 return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans);
3380
3381 if (change.to.line < doc.first) {
3382 shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));
3383 return;
3384 }
3385 if (change.from.line > doc.lastLine()) return;
3386
3387 // Clip the change to the size of this doc
3388 if (change.from.line < doc.first) {
3389 var shift = change.text.length - 1 - (doc.first - change.from.line);
3390 shiftDoc(doc, shift);
3391 change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),
3392 text: [lst(change.text)], origin: change.origin};
3393 }
3394 var last = doc.lastLine();
3395 if (change.to.line > last) {
3396 change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),
3397 text: [change.text[0]], origin: change.origin};
3398 }
3399
3400 change.removed = getBetween(doc, change.from, change.to);
3401
3402 if (!selAfter) selAfter = computeSelAfterChange(doc, change, null);
3403 if (doc.cm) makeChangeSingleDocInEditor(doc.cm, change, spans);
3404 else updateDoc(doc, change, spans);
3405 setSelectionNoUndo(doc, selAfter, sel_dontScroll);
3406 }
3407
3408 // Handle the interaction of a change to a document with the editor
3409 // that this document is part of.

Callers 2

makeChangeInnerFunction · 0.70
makeChangeFromHistoryFunction · 0.70

Calls 10

PosFunction · 0.85
setSelectionNoUndoFunction · 0.85
operationFunction · 0.70
shiftDocFunction · 0.70
lstFunction · 0.70
getLineFunction · 0.70
getBetweenFunction · 0.70
computeSelAfterChangeFunction · 0.70
updateDocFunction · 0.70

Tested by

no test coverage detected