MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / replaceRange

Function replaceRange

src/cli/components/editor-logic.ts:53–57  ·  view source on GitHub ↗
(text: string, from: number, to: number, s: string)

Source from the content-addressed store, hash-verified

51
52/** Replace the range [from,to) with `s`. Returns text + cursor after the inserted text. */
53export function replaceRange(text: string, from: number, to: number, s: string): { text: string; cursor: number } {
54 const a = Math.max(0, Math.min(from, to));
55 const b = Math.min(text.length, Math.max(from, to));
56 return { text: text.slice(0, a) + s + text.slice(b), cursor: a + s.length };
57}
58
59/**
60 * Ink delivers a terminal paste as a single multi-character burst in ONE useInput

Callers 2

ChatInputFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected