MCPcopy
hub / github.com/ether/etherpad / doRepLineSplice

Function doRepLineSplice

src/static/js/ace2_inner.ts:1699–1712  ·  view source on GitHub ↗
(startLine, deleteCount, newLineEntries)

Source from the content-addressed store, hash-verified

1697 // Change the abstract representation of the document to have a different set of lines.
1698 // Must be called after rep.alltext is set.
1699 const doRepLineSplice = (startLine, deleteCount, newLineEntries) => {
1700 for (const entry of newLineEntries) entry.width = entry.text.length + 1;
1701
1702 const startOldChar = rep.lines.offsetOfIndex(startLine);
1703 const endOldChar = rep.lines.offsetOfIndex(startLine + deleteCount);
1704
1705 rep.lines.splice(startLine, deleteCount, newLineEntries);
1706 currentCallStack.docTextChanged = true;
1707 currentCallStack.repChanged = true;
1708 const newText = newLineEntries.map((e) => `${e.text}\n`).join('');
1709
1710 rep.alltext = rep.alltext.substring(0, startOldChar) +
1711 newText + rep.alltext.substring(endOldChar, rep.alltext.length);
1712 };
1713
1714 const doIncorpLineSplice = (startLine, deleteCount, newLineEntries, lineAttribs, hints) => {
1715 const startOldChar = rep.lines.offsetOfIndex(startLine);

Callers 3

domAndRepSpliceFunction · 0.85
doIncorpLineSpliceFunction · 0.85
Ace2InnerFunction · 0.85

Calls 3

offsetOfIndexMethod · 0.80
spliceMethod · 0.80
mapMethod · 0.80

Tested by

no test coverage detected