Build wrapped stack-cell gutter/content lines while keeping continuation gutters blank.
( cell: StackLineCell, width: number, lineNumberDigits: number, showLineNumbers: boolean, prefixWidth: number, theme: AppTheme, )
| 392 | |
| 393 | /** Build wrapped stack-cell gutter/content lines while keeping continuation gutters blank. */ |
| 394 | function buildWrappedStackCell( |
| 395 | cell: StackLineCell, |
| 396 | width: number, |
| 397 | lineNumberDigits: number, |
| 398 | showLineNumbers: boolean, |
| 399 | prefixWidth: number, |
| 400 | theme: AppTheme, |
| 401 | ) { |
| 402 | const palette = stackCellPalette(cell.kind, theme); |
| 403 | const { gutterWidth, contentWidth } = resolveStackCellGeometry( |
| 404 | width, |
| 405 | lineNumberDigits, |
| 406 | showLineNumbers, |
| 407 | prefixWidth, |
| 408 | ); |
| 409 | const firstGutterText = stackGutterText(cell, lineNumberDigits, showLineNumbers).padEnd( |
| 410 | gutterWidth, |
| 411 | ); |
| 412 | const wrappedSpans = wrapSpans(cell.spans, contentWidth); |
| 413 | |
| 414 | return { |
| 415 | gutterWidth, |
| 416 | contentWidth, |
| 417 | palette, |
| 418 | lines: wrappedSpans.map((spans, index) => ({ |
| 419 | gutterText: index === 0 ? firstGutterText : " ".repeat(gutterWidth), |
| 420 | spans, |
| 421 | })), |
| 422 | } satisfies WrappedCellLayout; |
| 423 | } |
| 424 | |
| 425 | /** Convert a list of spans to fixed-width plain text while preserving logical clipping. */ |
| 426 | function spansToPlainText(spans: RenderSpan[], width: number, horizontalOffset = 0) { |
no test coverage detected