(patch: StructuredPatchHunk)
| 44 | // right-aligned line number (max_digits) + space. Depends only on patch |
| 45 | // identity (the WeakMap key), so it's cacheable alongside the NAPI output. |
| 46 | function computeGutterWidth(patch: StructuredPatchHunk): number { |
| 47 | const maxLineNumber = Math.max(patch.oldStart + patch.oldLines - 1, patch.newStart + patch.newLines - 1, 1); |
| 48 | return maxLineNumber.toString().length + 3; // marker + 2 padding spaces |
| 49 | } |
| 50 | function renderColorDiff(patch: StructuredPatchHunk, firstLine: string | null, filePath: string, fileContent: string | null, theme: string, width: number, dim: boolean, splitGutter: boolean): CachedRender | null { |
| 51 | const ColorDiff = expectColorDiff(); |
| 52 | if (!ColorDiff) return null; |
no test coverage detected