MCPcopy Create free account
hub / github.com/WJX20/claude-code / addLineNumber

Function addLineNumber

packages/color-diff-napi/src/index.ts:733–752  ·  view source on GitHub ↗
(
  h: Highlight,
  theme: Theme,
  maxDigits: number,
  fullDim: boolean,
)

Source from the content-addressed store, hash-verified

731}
732
733function addLineNumber(
734 h: Highlight,
735 theme: Theme,
736 maxDigits: number,
737 fullDim: boolean,
738): void {
739 const style: Style = {
740 foreground: h.marker ? decorationColor(h.marker, theme) : theme.foreground,
741 background: h.marker ? lineBackground(h.marker, theme) : theme.background,
742 }
743 const shouldDim = h.marker === null || h.marker === ' '
744 for (let i = 0; i < h.lines.length; i++) {
745 const prefix =
746 i === 0
747 ? ` ${String(h.lineNumber).padStart(maxDigits)} `
748 : ' '.repeat(maxDigits + 2)
749 const wrapped = shouldDim && !fullDim ? `${DIM}${prefix}${UNDIM}` : prefix
750 h.lines[i]!.unshift([style, wrapped])
751 }
752}
753
754function addMarker(h: Highlight, theme: Theme): void {
755 if (!h.marker) return

Callers 2

renderMethod · 0.85
renderMethod · 0.85

Calls 2

decorationColorFunction · 0.85
lineBackgroundFunction · 0.85

Tested by

no test coverage detected