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

Function filterChange

tools/pythonauto/static/codemirror/codemirror.js:2328–2348  ·  view source on GitHub ↗
(doc, change, update)

Source from the content-addressed store, hash-verified

2326 }
2327
2328 function filterChange(doc, change, update) {
2329 var obj = {
2330 canceled: false,
2331 from: change.from,
2332 to: change.to,
2333 text: change.text,
2334 origin: change.origin,
2335 cancel: function() { this.canceled = true; }
2336 };
2337 if (update) obj.update = function(from, to, text, origin) {
2338 if (from) this.from = clipPos(doc, from);
2339 if (to) this.to = clipPos(doc, to);
2340 if (text) this.text = text;
2341 if (origin !== undefined) this.origin = origin;
2342 };
2343 signal(doc, "beforeChange", doc, obj);
2344 if (doc.cm) signal(doc.cm, "beforeChange", doc.cm, obj);
2345
2346 if (obj.canceled) return null;
2347 return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin};
2348 }
2349
2350 // Replace the range from from to to by the strings in replacement.
2351 // change is a {from, to, text [, origin]} object

Callers 2

makeChangeFunction · 0.70
makeChangeFromHistoryFunction · 0.70

Calls 2

signalFunction · 0.85
clipPosFunction · 0.70

Tested by

no test coverage detected