MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / lineAtOffset

Function lineAtOffset

ui/src/lib/filecode-model.ts:122–126  ·  view source on GitHub ↗
(y: number, totalLines: number)

Source from the content-addressed store, hash-verified

120 * below the last, and both should read as the line they are adjacent to.
121 */
122export function lineAtOffset(y: number, totalLines: number): number {
123 if (totalLines <= 0) return 1;
124 const line = Math.floor((y - CODE_TOP_PAD) / CODE_LINE_HEIGHT) + 1;
125 return Math.max(1, Math.min(totalLines, line));
126}
127
128/** The 1-based lines to render for a scroll position, with overscan. */
129export function visibleLines(

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected