Render one non-interactive split diff row as ANSI text.
( row: DiffRow, theme: AppTheme, lineNumberWidth: number, options: CommonOptions, width: number, )
| 193 | |
| 194 | /** Render one non-interactive split diff row as ANSI text. */ |
| 195 | function 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 | |
| 227 | function maxLineNumberWidth(file: DiffFile, rows: DiffRow[]) { |
| 228 | let max = 1; |
no test coverage detected