(hunkIndex: number, hunks: readonly DiffHunk[])
| 217 | * @returns Scroll position (line offset) |
| 218 | */ |
| 219 | export 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. */ |
| 231 | const WIDGET_PALETTE = defaultTheme.colors; |
no outgoing calls
no test coverage detected