MCPcopy Index your code
hub / github.com/DHTMLX/gantt / copyHistoryArray

Function copyHistoryArray

samples/common/codehighlight/codemirror.js:4999–5021  ·  view source on GitHub ↗
(events, newGroup, instantiateSel)

Source from the content-addressed store, hash-verified

4997 // Used both to provide a JSON-safe object in .getHistory, and, when
4998 // detaching a document, to split the history in two
4999 function copyHistoryArray(events, newGroup, instantiateSel) {
5000 var copy = [];
5001 for (var i = 0; i < events.length; ++i) {
5002 var event = events[i];
5003 if (event.ranges) {
5004 copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);
5005 continue
5006 }
5007 var changes = event.changes, newChanges = [];
5008 copy.push({changes: newChanges});
5009 for (var j = 0; j < changes.length; ++j) {
5010 var change = changes[j], m = (void 0);
5011 newChanges.push({from: change.from, to: change.to, text: change.text});
5012 if (newGroup) { for (var prop in change) { if (m = prop.match(/^spans_(\d+)$/)) {
5013 if (indexOf(newGroup, Number(m[1])) > -1) {
5014 lst(newChanges)[prop] = change[prop];
5015 delete change[prop];
5016 }
5017 } } }
5018 }
5019 }
5020 return copy
5021 }
5022
5023 // The 'scroll' parameter given to many of these indicated whether
5024 // the new cursor position should be scrolled into view after

Callers 1

codemirror.jsFile · 0.85

Calls 2

indexOfFunction · 0.85
lstFunction · 0.85

Tested by

no test coverage detected