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

Function insertAt

src/cli/components/editor-logic.ts:34–37  ·  view source on GitHub ↗
(text: string, cursor: number, s: string)

Source from the content-addressed store, hash-verified

32
33/** Insert `s` at `cursor`. Returns new text and the cursor after the inserted text. */
34export function insertAt(text: string, cursor: number, s: string): { text: string; cursor: number } {
35 const c = Math.max(0, Math.min(cursor, text.length));
36 return { text: text.slice(0, c) + s + text.slice(c), cursor: c + s.length };
37}
38
39/** Backspace one char left of cursor. */
40export function backspace(text: string, cursor: number): { text: string; cursor: number } {

Callers 2

ChatInputFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected