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

Function normalizeInputSelection

packages/core/src/runtime/inputEditor.ts:240–251  ·  view source on GitHub ↗
(
  value: string,
  selectionStart: number | null | undefined,
  selectionEnd: number | null | undefined,
)

Source from the content-addressed store, hash-verified

238export type InputSelection = Readonly<{ start: number; end: number }>;
239
240export function normalizeInputSelection(
241 value: string,
242 selectionStart: number | null | undefined,
243 selectionEnd: number | null | undefined,
244): InputSelection | null {
245 if (selectionStart === null || selectionStart === undefined) return null;
246 if (selectionEnd === null || selectionEnd === undefined) return null;
247 const start = normalizeInputCursor(value, selectionStart);
248 const end = normalizeInputCursor(value, selectionEnd);
249 if (start === end) return null;
250 return Object.freeze({ start, end });
251}
252
253export function getInputSelectionText(
254 value: string,

Callers 6

submitFrameMethod · 0.85
readInputSnapshotFunction · 0.85
routeInputEditingEventFunction · 0.85
getInputSelectionTextFunction · 0.85
applyInputEditEventFunction · 0.85
assertInvariantsFunction · 0.85

Calls 1

normalizeInputCursorFunction · 0.85

Tested by 1

assertInvariantsFunction · 0.68