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

Function findLineIndexAtCursor

packages/core/src/runtime/inputEditor.ts:425–432  ·  view source on GitHub ↗
(lines: InputLineRanges, cursor: number)

Source from the content-addressed store, hash-verified

423}
424
425function findLineIndexAtCursor(lines: InputLineRanges, cursor: number): number {
426 const c = Math.max(0, cursor);
427 for (let i = 0; i < lines.ends.length; i++) {
428 const end = lines.ends[i] ?? 0;
429 if (c <= end) return i;
430 }
431 return Math.max(0, lines.ends.length - 1);
432}
433
434function moveCursorToLineEdge(value: string, cursor: number, edge: "home" | "end"): number {
435 const lines = buildInputLineRanges(value);

Callers 2

moveCursorToLineEdgeFunction · 0.85
moveCursorVerticalFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected