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

Function getHunkScrollPosition

packages/core/src/widgets/diffViewer.ts:219–228  ·  view source on GitHub ↗
(hunkIndex: number, hunks: readonly DiffHunk[])

Source from the content-addressed store, hash-verified

217 * @returns Scroll position (line offset)
218 */
219export function getHunkScrollPosition(hunkIndex: number, hunks: readonly DiffHunk[]): number {
220 let offset = 0;
221 for (let i = 0; i < hunkIndex && i < hunks.length; i++) {
222 const hunk = hunks[i];
223 if (hunk) {
224 offset += hunk.lines.length + 1; // +1 for hunk header
225 }
226 }
227 return offset;
228}
229
230/** Diff color constants. */
231const WIDGET_PALETTE = defaultTheme.colors;

Callers 1

routeDiffViewerKeyDownFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected