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

Function lineRange

docs/components/editor.js:65–71  ·  view source on GitHub ↗
(text, sel)

Source from the content-addressed store, hash-verified

63
64 // Full lines covered by `sel`; excludes the trailing line if `sel.end` sits exactly past a `\n`.
65 const lineRange = (text, sel) => {
66 const start = text.lastIndexOf('\n', sel.start - 1) + 1;
67 const anchor = (sel.end > sel.start && text[sel.end - 1] === '\n') ? sel.end - 1 : sel.end;
68 let end = text.indexOf('\n', anchor);
69 if (end === -1) end = text.length;
70 return { start, end };
71 };
72
73 // Strip common leading-whitespace from non-empty lines so a snippet pasted from deeper context lands flush.
74 const dedentCommon = (s) => {

Callers 1

createEditorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected