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

Function buildInputLineRanges

packages/core/src/runtime/inputEditor.ts:409–423  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

407}>;
408
409function buildInputLineRanges(value: string): InputLineRanges {
410 const starts: number[] = [];
411 const ends: number[] = [];
412 let lineStart = 0;
413 for (let i = 0; i < value.length; i++) {
414 if (value.charCodeAt(i) === 0x0a) {
415 starts.push(lineStart);
416 ends.push(i);
417 lineStart = i + 1;
418 }
419 }
420 starts.push(lineStart);
421 ends.push(value.length);
422 return Object.freeze({ starts: Object.freeze(starts), ends: Object.freeze(ends) });
423}
424
425function findLineIndexAtCursor(lines: InputLineRanges, cursor: number): number {
426 const c = Math.max(0, cursor);

Callers 2

moveCursorToLineEdgeFunction · 0.85
moveCursorVerticalFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected