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

Function buildPlainSplitCellLines

src/ui/diff/renderRows.tsx:455–499  ·  view source on GitHub ↗
(
  cell: SplitLineCell,
  width: number,
  lineNumberDigits: number,
  showLineNumbers: boolean,
  prefixWidth: number,
  theme: AppTheme,
  wrapLines: boolean,
  codeHorizontalOffset = 0,
)

Source from the content-addressed store, hash-verified

453}
454
455function buildPlainSplitCellLines(
456 cell: SplitLineCell,
457 width: number,
458 lineNumberDigits: number,
459 showLineNumbers: boolean,
460 prefixWidth: number,
461 theme: AppTheme,
462 wrapLines: boolean,
463 codeHorizontalOffset = 0,
464) {
465 if (!wrapLines) {
466 const { gutterWidth, contentWidth } = resolveSplitCellGeometry(
467 width,
468 lineNumberDigits,
469 showLineNumbers,
470 prefixWidth,
471 );
472 const gutterText = splitGutterText(cell, lineNumberDigits, showLineNumbers).padEnd(gutterWidth);
473
474 return [
475 {
476 contentWidth,
477 gutterWidth,
478 spansText: gutterText + spansToPlainText(cell.spans, contentWidth, codeHorizontalOffset),
479 },
480 ];
481 }
482
483 const layout = buildWrappedSplitCell(
484 cell,
485 width,
486 lineNumberDigits,
487 showLineNumbers,
488 prefixWidth,
489 theme,
490 );
491
492 // Mirror the TUI renderer, which does not apply horizontal scrolling to wrapped rows.
493 // Keeping the plain-text path aligned avoids visual/clipboard drift.
494 return layout.lines.map((line) => ({
495 contentWidth: layout.contentWidth,
496 gutterWidth: layout.gutterWidth,
497 spansText: line.gutterText + spansToPlainText(line.spans, layout.contentWidth),
498 }));
499}
500
501function buildPlainStackCellLines(
502 cell: StackLineCell,

Callers 1

Calls 4

resolveSplitCellGeometryFunction · 0.90
splitGutterTextFunction · 0.90
spansToPlainTextFunction · 0.85
buildWrappedSplitCellFunction · 0.85

Tested by

no test coverage detected