MCPcopy Create free account
hub / github.com/RtlZeroMemory/Rezi / clampInputCursor

Function clampInputCursor

packages/core/src/runtime/inputEditor.ts:197–203  ·  view source on GitHub ↗
(value: string, cursor: number)

Source from the content-addressed store, hash-verified

195}
196
197function clampInputCursor(value: string, cursor: number): number {
198 let c = cursor;
199 if (!Number.isFinite(c)) c = 0;
200 if (c < 0) c = 0;
201 if (c > value.length) c = value.length;
202 return c;
203}
204
205/**
206 * Normalize cursor position to a valid grapheme cluster boundary.

Callers 3

normalizeInputCursorFunction · 0.85
prevWordBoundaryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected