Render one non-interactive stacked diff row as ANSI text.
( row: DiffRow, theme: AppTheme, lineNumberWidth: number, options: CommonOptions, )
| 132 | |
| 133 | /** Render one non-interactive stacked diff row as ANSI text. */ |
| 134 | function 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 | |
| 163 | function renderStaticSplitCell( |
| 164 | cell: SplitLineCell, |
no test coverage detected