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

Function wordLeft

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

Source from the content-addressed store, hash-verified

9
10/** Index after jumping one word LEFT from `cursor` (skip whitespace, then word). */
11export function wordLeft(text: string, cursor: number): number {
12 let i = Math.max(0, Math.min(cursor, text.length));
13 while (i > 0 && isWS(text[i - 1]!)) i--;
14 while (i > 0 && !isWS(text[i - 1]!)) i--;
15 return i;
16}
17
18/** Index after jumping one word RIGHT from `cursor` (skip whitespace, then word). */
19export function wordRight(text: string, cursor: number): number {

Callers 3

ChatInputFunction · 0.85
deleteWordLeftFunction · 0.85

Calls 1

isWSFunction · 0.85

Tested by

no test coverage detected