MCPcopy Create free account
hub / github.com/modem-dev/hunk / renderStaticSplitCell

Function renderStaticSplitCell

src/ui/staticDiffPager.ts:163–192  ·  view source on GitHub ↗
(
  cell: SplitLineCell,
  side: "left" | "right",
  width: number,
  theme: AppTheme,
  lineNumberWidth: number,
  options: CommonOptions,
)

Source from the content-addressed store, hash-verified

161}
162
163function renderStaticSplitCell(
164 cell: SplitLineCell,
165 side: "left" | "right",
166 width: number,
167 theme: AppTheme,
168 lineNumberWidth: number,
169 options: CommonOptions,
170) {
171 const palette = splitCellPalette(cell.kind, theme, cell.moveKind);
172 const { gutterWidth, contentWidth } = resolveSplitCellGeometry(
173 width,
174 lineNumberWidth,
175 options.lineNumbers !== false,
176 marker().length,
177 );
178 const railColor =
179 side === "left"
180 ? splitLeftRailColor(cell.kind, theme, true)
181 : splitRightRailColor(cell.kind, theme, true);
182 const gutterText = fixedWidthText(
183 staticSplitGutterText(cell, lineNumberWidth, options.lineNumbers !== false),
184 gutterWidth,
185 );
186
187 return `${colorText(marker(), railColor, theme.panel)}${colorText(
188 gutterText,
189 palette.numberColor,
190 palette.gutterBg,
191 )}${serializeSpansFixedWidth(cell.spans, palette.contentBg, contentWidth)}`;
192}
193
194/** Render one non-interactive split diff row as ANSI text. */
195function renderStaticSplitRow(

Callers 1

renderStaticSplitRowFunction · 0.85

Calls 8

splitCellPaletteFunction · 0.90
resolveSplitCellGeometryFunction · 0.90
splitLeftRailColorFunction · 0.90
splitRightRailColorFunction · 0.90
fixedWidthTextFunction · 0.85
staticSplitGutterTextFunction · 0.85
colorTextFunction · 0.85
serializeSpansFixedWidthFunction · 0.85

Tested by

no test coverage detected