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

Function wordRight

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

Source from the content-addressed store, hash-verified

17
18/** Index after jumping one word RIGHT from `cursor` (skip whitespace, then word). */
19export function wordRight(text: string, cursor: number): number {
20 const n = text.length;
21 let i = Math.max(0, Math.min(cursor, n));
22 while (i < n && isWS(text[i]!)) i++;
23 while (i < n && !isWS(text[i]!)) i++;
24 return i;
25}
26
27/** Delete the word immediately left of the cursor (Ctrl+W). Returns new text+cursor. */
28export function deleteWordLeft(text: string, cursor: number): { text: string; cursor: number } {

Callers 2

ChatInputFunction · 0.85

Calls 1

isWSFunction · 0.85

Tested by

no test coverage detected