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

Function deleteRange

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

Source from the content-addressed store, hash-verified

44
45/** Delete the half-open range [from,to) (order-independent). Returns text + cursor at range start. */
46export function deleteRange(text: string, from: number, to: number): { text: string; cursor: number } {
47 const a = Math.max(0, Math.min(from, to));
48 const b = Math.min(text.length, Math.max(from, to));
49 return { text: text.slice(0, a) + text.slice(b), cursor: a };
50}
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 } {

Callers 2

ChatInputFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected