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

Function buildWrappedSplitCell

src/ui/diff/renderRows.tsx:362–391  ·  view source on GitHub ↗

Build wrapped split-cell gutter/content lines while keeping continuation gutters blank.

(
  cell: SplitLineCell,
  width: number,
  lineNumberDigits: number,
  showLineNumbers: boolean,
  prefixWidth: number,
  theme: AppTheme,
)

Source from the content-addressed store, hash-verified

360
361/** Build wrapped split-cell gutter/content lines while keeping continuation gutters blank. */
362function buildWrappedSplitCell(
363 cell: SplitLineCell,
364 width: number,
365 lineNumberDigits: number,
366 showLineNumbers: boolean,
367 prefixWidth: number,
368 theme: AppTheme,
369) {
370 const palette = splitCellPalette(cell.kind, theme);
371 const { gutterWidth, contentWidth } = resolveSplitCellGeometry(
372 width,
373 lineNumberDigits,
374 showLineNumbers,
375 prefixWidth,
376 );
377 const firstGutterText = splitGutterText(cell, lineNumberDigits, showLineNumbers).padEnd(
378 gutterWidth,
379 );
380 const wrappedSpans = wrapSpans(cell.spans, contentWidth);
381
382 return {
383 gutterWidth,
384 contentWidth,
385 palette,
386 lines: wrappedSpans.map((spans, index) => ({
387 gutterText: index === 0 ? firstGutterText : " ".repeat(gutterWidth),
388 spans,
389 })),
390 } satisfies WrappedCellLayout;
391}
392
393/** Build wrapped stack-cell gutter/content lines while keeping continuation gutters blank. */
394function buildWrappedStackCell(

Callers 4

buildPlainSplitCellLinesFunction · 0.85
measureRenderedRowHeightFunction · 0.85
renderRowFunction · 0.85

Calls 4

splitCellPaletteFunction · 0.90
resolveSplitCellGeometryFunction · 0.90
splitGutterTextFunction · 0.90
wrapSpansFunction · 0.85

Tested by

no test coverage detected