(log: LogOption, maxLabelWidth: number, options?: {
isGroupHeader?: boolean;
isChild?: boolean;
forkCount?: number;
})
| 108 | }; |
| 109 | } |
| 110 | function buildLogLabel(log: LogOption, maxLabelWidth: number, options?: { |
| 111 | isGroupHeader?: boolean; |
| 112 | isChild?: boolean; |
| 113 | forkCount?: number; |
| 114 | }): string { |
| 115 | const { |
| 116 | isGroupHeader = false, |
| 117 | isChild = false, |
| 118 | forkCount = 0 |
| 119 | } = options || {}; |
| 120 | |
| 121 | // TreeSelect will add the prefix, so we just need to account for its width |
| 122 | const prefixWidth = isGroupHeader && forkCount > 0 ? PARENT_PREFIX_WIDTH : isChild ? CHILD_PREFIX_WIDTH : 0; |
| 123 | const sessionCountSuffix = isGroupHeader && forkCount > 0 ? ` (+${forkCount} other ${forkCount === 1 ? 'session' : 'sessions'})` : ''; |
| 124 | const sidechainSuffix = log.isSidechain ? ' (sidechain)' : ''; |
| 125 | const maxSummaryWidth = maxLabelWidth - prefixWidth - sidechainSuffix.length - sessionCountSuffix.length; |
| 126 | const truncatedSummary = normalizeAndTruncateToWidth(getLogDisplayTitle(log), maxSummaryWidth); |
| 127 | return `${truncatedSummary}${sidechainSuffix}${sessionCountSuffix}`; |
| 128 | } |
| 129 | function buildLogMetadata(log: LogOption, options?: { |
| 130 | isChild?: boolean; |
| 131 | showProjectPath?: boolean; |
no test coverage detected