MCPcopy
hub / github.com/kekingcn/kkFileView / copyHistoryArray

Function copyHistoryArray

server/src/main/resources/static/js/codemirror.js:1122–1124  ·  view source on GitHub ↗
(events,newGroup,instantiateSel)

Source from the content-addressed store, hash-verified

1120oldCur.push(span);}}else if(stretchCur){old[i]=stretchCur;}}
1121return old}
1122function copyHistoryArray(events,newGroup,instantiateSel){var copy=[];for(var i=0;i<events.length;++i){var event=events[i];if(event.ranges){copy.push(instantiateSel?Selection.prototype.deepCopy.call(event):event);continue}
1123var changes=event.changes,newChanges=[];copy.push({changes:newChanges});for(var j=0;j<changes.length;++j){var change=changes[j],m=(void 0);newChanges.push({from:change.from,to:change.to,text:change.text});if(newGroup){for(var prop in change){if(m=prop.match(/^spans_(\d+)$/)){if(indexOf(newGroup,Number(m[1]))>-1){lst(newChanges)[prop]=change[prop];delete change[prop];}}}}}}
1124return copy}
1125function extendRange(range,head,other,extend){if(extend){var anchor=range.anchor;if(other){var posBefore=cmp(head,anchor)<0;if(posBefore!=(cmp(other,anchor)<0)){anchor=head;head=other;}else if(posBefore!=(cmp(head,other)<0)){head=other;}}
1126return new Range(anchor,head)}else{return new Range(other||head,head)}}
1127function extendSelection(doc,head,other,options,extend){if(extend==null){extend=doc.cm&&(doc.cm.display.shift||doc.extend);}

Callers 1

codemirror.jsFile · 0.85

Calls 5

lstFunction · 0.85
indexOfFunction · 0.70
NumberClass · 0.50
pushMethod · 0.45
matchMethod · 0.45

Tested by

no test coverage detected