MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / computeGutterWidth

Function computeGutterWidth

source code/components/StructuredDiff.tsx:48–51  ·  view source on GitHub ↗
(patch: StructuredPatchHunk)

Source from the content-addressed store, hash-verified

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

Callers 1

renderColorDiffFunction · 0.85

Calls 2

maxMethod · 0.80
toStringMethod · 0.65

Tested by

no test coverage detected