()
| 157 | |
| 158 | // Step 4: Calculate max row lines to determine if vertical format is needed |
| 159 | function calculateMaxRowLines(): number { |
| 160 | let maxLines = 1; |
| 161 | // Check header |
| 162 | for (let i_1 = 0; i_1 < token.header.length; i_1++) { |
| 163 | const content = formatCell(token.header[i_1]!.tokens); |
| 164 | const wrapped = wrapText(content, columnWidths[i_1]!, { |
| 165 | hard: needsHardWrap |
| 166 | }); |
| 167 | maxLines = Math.max(maxLines, wrapped.length); |
| 168 | } |
| 169 | // Check rows |
| 170 | for (const row_1 of token.rows) { |
| 171 | for (let i_2 = 0; i_2 < row_1.length; i_2++) { |
| 172 | const content_0 = formatCell(row_1[i_2]?.tokens); |
| 173 | const wrapped_0 = wrapText(content_0, columnWidths[i_2]!, { |
| 174 | hard: needsHardWrap |
| 175 | }); |
| 176 | maxLines = Math.max(maxLines, wrapped_0.length); |
| 177 | } |
| 178 | } |
| 179 | return maxLines; |
| 180 | } |
| 181 | |
| 182 | // Use vertical format if wrapping would make rows too tall |
| 183 | const maxRowLines = calculateMaxRowLines(); |
no test coverage detected