(theme: Theme, directory: string, contentWidth: number, recents: RecentSessionSummary[])
| 128 | type ColumnLine = Segment | undefined |
| 129 | |
| 130 | function buildContentRows(theme: Theme, directory: string, contentWidth: number, recents: RecentSessionSummary[]) { |
| 131 | const minColumns = { left: 22, right: 20 } |
| 132 | let leftWidth = Math.max(minColumns.left, Math.floor(contentWidth * 0.55)) |
| 133 | let rightWidth = contentWidth - leftWidth - 3 |
| 134 | if (rightWidth < minColumns.right) { |
| 135 | rightWidth = minColumns.right |
| 136 | leftWidth = Math.max(minColumns.left, contentWidth - rightWidth - 3) |
| 137 | } |
| 138 | const rows: Segment[][] = [] |
| 139 | const leftLines = buildLeftColumn(theme, directory, leftWidth) |
| 140 | const rightLines = buildRightColumn(theme, rightWidth, recents) |
| 141 | const totalRows = Math.max(leftLines.length, rightLines.length) |
| 142 | for (let i = 0; i < totalRows; i++) { |
| 143 | rows.push(buildTwoColumnRow(leftLines[i], rightLines[i], leftWidth, rightWidth, theme)) |
| 144 | } |
| 145 | return rows |
| 146 | } |
| 147 | |
| 148 | function buildLeftColumn(theme: Theme, directory: string, width: number): ColumnLine[] { |
| 149 | const lines: ColumnLine[] = [] |
no test coverage detected