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

Function getInputSelectionText

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

Source from the content-addressed store, hash-verified

251}
252
253export function getInputSelectionText(
254 value: string,
255 selectionStart: number | null | undefined,
256 selectionEnd: number | null | undefined,
257): string | null {
258 const selection = normalizeInputSelection(value, selectionStart, selectionEnd);
259 if (!selection) return null;
260 const [start, end] =
261 selection.start <= selection.end
262 ? [selection.start, selection.end]
263 : [selection.end, selection.start];
264 if (start >= end) return null;
265 return value.slice(start, end);
266}
267
268function asUnicodeScalarString(codepoint: number): string {
269 if (!Number.isFinite(codepoint)) return "\ufffd";

Callers 2

routeInputEditingEventFunction · 0.85

Calls 1

normalizeInputSelectionFunction · 0.85

Tested by

no test coverage detected