( cell: StackLineCell, width: number, lineNumberDigits: number, showLineNumbers: boolean, prefixWidth: number, theme: AppTheme, wrapLines: boolean, codeHorizontalOffset = 0, )
| 499 | } |
| 500 | |
| 501 | function buildPlainStackCellLines( |
| 502 | cell: StackLineCell, |
| 503 | width: number, |
| 504 | lineNumberDigits: number, |
| 505 | showLineNumbers: boolean, |
| 506 | prefixWidth: number, |
| 507 | theme: AppTheme, |
| 508 | wrapLines: boolean, |
| 509 | codeHorizontalOffset = 0, |
| 510 | ) { |
| 511 | if (!wrapLines) { |
| 512 | const { gutterWidth, contentWidth } = resolveStackCellGeometry( |
| 513 | width, |
| 514 | lineNumberDigits, |
| 515 | showLineNumbers, |
| 516 | prefixWidth, |
| 517 | ); |
| 518 | const gutterText = stackGutterText(cell, lineNumberDigits, showLineNumbers).padEnd(gutterWidth); |
| 519 | |
| 520 | return [ |
| 521 | { |
| 522 | contentWidth, |
| 523 | gutterWidth, |
| 524 | spansText: gutterText + spansToPlainText(cell.spans, contentWidth, codeHorizontalOffset), |
| 525 | }, |
| 526 | ]; |
| 527 | } |
| 528 | |
| 529 | const layout = buildWrappedStackCell( |
| 530 | cell, |
| 531 | width, |
| 532 | lineNumberDigits, |
| 533 | showLineNumbers, |
| 534 | prefixWidth, |
| 535 | theme, |
| 536 | ); |
| 537 | |
| 538 | // Mirror the TUI renderer, which does not apply horizontal scrolling to wrapped rows. |
| 539 | return layout.lines.map((line) => ({ |
| 540 | contentWidth: layout.contentWidth, |
| 541 | gutterWidth: layout.gutterWidth, |
| 542 | spansText: line.gutterText + spansToPlainText(line.spans, layout.contentWidth), |
| 543 | })); |
| 544 | } |
| 545 | |
| 546 | /** Render the marker + label that hunk-header and collapsed rows share in plain-text form. */ |
| 547 | function renderHeaderRowText(text: string, width: number) { |
no test coverage detected