spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

claude-code / mods / diff / hooks / views / detail / gutter-cells-of / gutter-cells-of.ts
12 lines · 417 BRaw
1import type Types from '../types'
2
3/**
4 * How wide the line-number gutter is for these lines: the longest number's
5 * digits and one leading cell (StructuredDiff's digits + 1).
6 *
7 * @param lines the numbered lines
8 * @returns the gutter's width in cells
9 */
10export const gutterCellsOf = (lines: readonly Types.DiffLine[]) =>
11 String(lines.reduce((most, line) => Math.max(most, line.lineNumber), 0))
12 .length + 1