MCPcopy
hub / github.com/csev/py4e / makeChange

Function makeChange

tools/pythonauto/static/codemirrorepl/codemirror.js:3260–3280  ·  view source on GitHub ↗
(doc, change, ignoreReadOnly)

Source from the content-addressed store, hash-verified

3258 // Apply a change to a document, and add it to the document's
3259 // history, and propagating it to all linked documents.
3260 function makeChange(doc, change, ignoreReadOnly) {
3261 if (doc.cm) {
3262 if (!doc.cm.curOp) return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly);
3263 if (doc.cm.state.suppressEdits) return;
3264 }
3265
3266 if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) {
3267 change = filterChange(doc, change, true);
3268 if (!change) return;
3269 }
3270
3271 // Possibly split or suppress the update based on the presence
3272 // of read-only spans in its range.
3273 var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);
3274 if (split) {
3275 for (var i = split.length - 1; i >= 0; --i)
3276 makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text});
3277 } else {
3278 makeChangeInner(doc, change);
3279 }
3280 }
3281
3282 function makeChangeInner(doc, change) {
3283 if (change.text.length == 1 && change.text[0] == "" && cmp(change.from, change.to) == 0) return;

Callers 4

readInputFunction · 0.70
loadFileFunction · 0.70
replaceRangeFunction · 0.70
codemirror.jsFile · 0.70

Calls 5

makeChangeInnerFunction · 0.85
operationFunction · 0.70
hasHandlerFunction · 0.70
filterChangeFunction · 0.70
removeReadOnlyRangesFunction · 0.70

Tested by

no test coverage detected