MCPcopy
hub / github.com/nwutils/nw-sample-apps / copyStyles

Function copyStyles

mini-code-edit/cm/lib/codemirror.js:2583–2596  ·  view source on GitHub ↗
(from, to, source, dest)

Source from the content-addressed store, hash-verified

2581 };
2582 // Utility used by replace and split above
2583 function copyStyles(from, to, source, dest) {
2584 for (var i = 0, pos = 0, state = 0; pos < to; i+=2) {
2585 var part = source[i], end = pos + part.length;
2586 if (state == 0) {
2587 if (end > from) dest.push(part.slice(from - pos, Math.min(part.length, to - pos)), source[i+1]);
2588 if (end >= from) state = 1;
2589 }
2590 else if (state == 1) {
2591 if (end > to) dest.push(part.slice(0, to - pos), source[i+1]);
2592 else dest.push(part, source[i+1]);
2593 }
2594 pos = end;
2595 }
2596 }
2597
2598 // Data structure that holds the sequence of lines.
2599 function LeafChunk(lines) {

Callers 1

codemirror.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected