MCPcopy Create free account
hub / github.com/dylan-sutton-chavez/edge-python / insertAtCaret

Function insertAtCaret

docs/components/editor.js:248–255  ·  view source on GitHub ↗
(str)

Source from the content-addressed store, hash-verified

246
247 // Insert plain text at caret, replacing any selection; used by paste/drop after normalisation. Enforces `MAX_LINES`.
248 const insertAtCaret = (str) => {
249 const pos = jar.save();
250 const text = jar.toString();
251 let next = text.slice(0, pos.start) + str + text.slice(pos.end);
252 const all = next.split('\n');
253 if (all.length > MAX_LINES) next = all.slice(0, MAX_LINES).join('\n');
254 writeAndRestore(next, Math.min(pos.start + str.length, next.length));
255 };
256
257 // Paste/drop pipeline: strip ```python fence, normalise CRLF+tabs, smart-dedent common indent, enforce `MAX_LINES`.
258 const insertNormalized = (raw) => {

Callers 1

insertNormalizedFunction · 0.85

Calls 2

writeAndRestoreFunction · 0.85
saveMethod · 0.80

Tested by

no test coverage detected