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

Function renderStaticStackRow

src/ui/staticDiffPager.ts:134–161  ·  view source on GitHub ↗

Render one non-interactive stacked diff row as ANSI text.

(
  row: DiffRow,
  theme: AppTheme,
  lineNumberWidth: number,
  options: CommonOptions,
)

Source from the content-addressed store, hash-verified

132
133/** Render one non-interactive stacked diff row as ANSI text. */
134function renderStaticStackRow(
135 row: DiffRow,
136 theme: AppTheme,
137 lineNumberWidth: number,
138 options: CommonOptions,
139) {
140 if (row.type === "collapsed") {
141 return renderHeaderLikeRow(`··· ${row.text} ···`, theme.muted, theme.panelAlt, theme);
142 }
143
144 if (row.type === "hunk-header") {
145 return options.hunkHeaders === false
146 ? ""
147 : renderHeaderLikeRow(row.text, theme.badgeNeutral, theme.panelAlt, theme);
148 }
149
150 if (row.type !== "stack-line") {
151 return "";
152 }
153
154 const { cell } = row;
155 const palette = stackCellPalette(cell.kind, theme, cell.moveKind);
156 return `${colorText(marker(), stackRailColor(cell.kind, theme, true), theme.panel)}${colorText(
157 staticStackGutterText(cell, lineNumberWidth, options.lineNumbers !== false),
158 palette.numberColor,
159 palette.gutterBg,
160 )}${serializeSpans(cell.spans, palette.contentBg)}`;
161}
162
163function renderStaticSplitCell(
164 cell: SplitLineCell,

Callers 1

renderStaticFileFunction · 0.85

Calls 6

stackCellPaletteFunction · 0.90
stackRailColorFunction · 0.90
renderHeaderLikeRowFunction · 0.85
colorTextFunction · 0.85
staticStackGutterTextFunction · 0.85
serializeSpansFunction · 0.85

Tested by

no test coverage detected