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

Function renderStaticSplitRow

src/ui/staticDiffPager.ts:195–225  ·  view source on GitHub ↗

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

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

Source from the content-addressed store, hash-verified

193
194/** Render one non-interactive split diff row as ANSI text. */
195function renderStaticSplitRow(
196 row: DiffRow,
197 theme: AppTheme,
198 lineNumberWidth: number,
199 options: CommonOptions,
200 width: number,
201) {
202 if (row.type === "collapsed") {
203 return renderHeaderLikeRow(`··· ${row.text} ···`, theme.muted, theme.panelAlt, theme);
204 }
205
206 if (row.type === "hunk-header") {
207 return options.hunkHeaders === false
208 ? ""
209 : renderHeaderLikeRow(row.text, theme.badgeNeutral, theme.panelAlt, theme);
210 }
211
212 if (row.type !== "split-line") {
213 return "";
214 }
215
216 const { leftWidth, rightWidth } = resolveSplitPaneWidths(width);
217 return `${renderStaticSplitCell(
218 row.left,
219 "left",
220 leftWidth,
221 theme,
222 lineNumberWidth,
223 options,
224 )}${renderStaticSplitCell(row.right, "right", rightWidth, theme, lineNumberWidth, options)}`;
225}
226
227function maxLineNumberWidth(file: DiffFile, rows: DiffRow[]) {
228 let max = 1;

Callers 1

renderStaticFileFunction · 0.85

Calls 3

resolveSplitPaneWidthsFunction · 0.90
renderHeaderLikeRowFunction · 0.85
renderStaticSplitCellFunction · 0.85

Tested by

no test coverage detected