MCPcopy
hub / github.com/codeaashu/claude-code / computeGutterWidth

Function computeGutterWidth

src/components/StructuredDiff.tsx:46–49  ·  view source on GitHub ↗
(patch: StructuredPatchHunk)

Source from the content-addressed store, hash-verified

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.
46function 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}
50function 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;

Callers 1

renderColorDiffFunction · 0.85

Calls 2

maxMethod · 0.80
toStringMethod · 0.65

Tested by

no test coverage detected