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

Function copyHistoryArray

tools/pythonauto/static/codemirror/codemirror.js:5389–5406  ·  view source on GitHub ↗
(events, newGroup)

Source from the content-addressed store, hash-verified

5387 // Used both to provide a JSON-safe object in .getHistory, and, when
5388 // detaching a document, to split the history in two
5389 function copyHistoryArray(events, newGroup) {
5390 for (var i = 0, copy = []; i < events.length; ++i) {
5391 var event = events[i], changes = event.changes, newChanges = [];
5392 copy.push({changes: newChanges, anchorBefore: event.anchorBefore, headBefore: event.headBefore,
5393 anchorAfter: event.anchorAfter, headAfter: event.headAfter});
5394 for (var j = 0; j < changes.length; ++j) {
5395 var change = changes[j], m;
5396 newChanges.push({from: change.from, to: change.to, text: change.text});
5397 if (newGroup) for (var prop in change) if (m = prop.match(/^spans_(\d+)$/)) {
5398 if (indexOf(newGroup, Number(m[1])) > -1) {
5399 lst(newChanges)[prop] = change[prop];
5400 delete change[prop];
5401 }
5402 }
5403 }
5404 }
5405 return copy;
5406 }
5407
5408 // Rebasing/resetting history to deal with externally-sourced changes
5409

Callers 1

codemirror.jsFile · 0.70

Calls 2

indexOfFunction · 0.70
lstFunction · 0.70

Tested by

no test coverage detected