Render one already-wrapped stack cell line with its persistent rail prefix.
(
line: WrappedCellLine,
palette: ReturnType<typeof stackCellPalette>,
contentWidth: number,
theme: AppTheme,
keyPrefix: string,
prefix: {
text: string;
fg: string;
bg: string;
},
selected = false,
selectionColRange?: CopySelectedRowRange,
)
| 1042 | |
| 1043 | /** Render one already-wrapped stack cell line with its persistent rail prefix. */ |
| 1044 | function renderWrappedStackCellLine( |
| 1045 | line: WrappedCellLine, |
| 1046 | palette: ReturnType<typeof stackCellPalette>, |
| 1047 | contentWidth: number, |
| 1048 | theme: AppTheme, |
| 1049 | keyPrefix: string, |
| 1050 | prefix: { |
| 1051 | text: string; |
| 1052 | fg: string; |
| 1053 | bg: string; |
| 1054 | }, |
| 1055 | selected = false, |
| 1056 | selectionColRange?: CopySelectedRowRange, |
| 1057 | ) { |
| 1058 | const resolvedPalette = selected ? applySelectionPalette(palette, theme) : palette; |
| 1059 | const resolvedPrefix = selected ? applySelectionPrefix(prefix, theme) : prefix; |
| 1060 | |
| 1061 | const prefixWidth = prefix.text.length; |
| 1062 | const gutterWidth = line.gutterText.length; |
| 1063 | const globalContentStart = prefixWidth + gutterWidth; |
| 1064 | const localColRange = |
| 1065 | selectionColRange && globalContentStart < selectionColRange.endCol |
| 1066 | ? { |
| 1067 | start: Math.max(0, selectionColRange.startCol - globalContentStart), |
| 1068 | end: Math.min( |
| 1069 | contentWidth, |
| 1070 | Math.max(0, selectionColRange.endCol - globalContentStart + 1), |
| 1071 | ), |
| 1072 | } |
| 1073 | : undefined; |
| 1074 | |
| 1075 | return ( |
| 1076 | <> |
| 1077 | <span key={`${keyPrefix}:prefix`} fg={resolvedPrefix.fg} bg={resolvedPrefix.bg}> |
| 1078 | {resolvedPrefix.text} |
| 1079 | </span> |
| 1080 | <span |
| 1081 | key={`${keyPrefix}:gutter`} |
| 1082 | fg={resolvedPalette.numberColor} |
| 1083 | bg={resolvedPalette.gutterBg} |
| 1084 | > |
| 1085 | {line.gutterText} |
| 1086 | </span> |
| 1087 | {renderInlineSpans( |
| 1088 | line.spans, |
| 1089 | contentWidth, |
| 1090 | theme.syntaxColors.default, |
| 1091 | resolvedPalette.contentBg, |
| 1092 | `${keyPrefix}:content`, |
| 1093 | 0, |
| 1094 | selected ? theme : undefined, |
| 1095 | localColRange, |
| 1096 | )} |
| 1097 | </> |
| 1098 | ); |
| 1099 | } |
| 1100 | |
| 1101 | /** Explain why a file still appears in the review stream even when it has no textual hunks. */ |
no test coverage detected