( width: number, lineNumberDigits: number, showLineNumbers: boolean, prefixWidth = DIFF_RAIL_PREFIX_WIDTH, )
| 110 | |
| 111 | /** Resolve the stack-cell gutter and code viewport after the left rail prefix. */ |
| 112 | export function resolveStackCellGeometry( |
| 113 | width: number, |
| 114 | lineNumberDigits: number, |
| 115 | showLineNumbers: boolean, |
| 116 | prefixWidth = DIFF_RAIL_PREFIX_WIDTH, |
| 117 | ) { |
| 118 | const availableWidth = Math.max(0, width - prefixWidth); |
| 119 | const gutterWidth = Math.min(availableWidth, showLineNumbers ? lineNumberDigits * 2 + 5 : 2); |
| 120 | |
| 121 | return { |
| 122 | gutterWidth, |
| 123 | contentWidth: Math.max(0, availableWidth - gutterWidth), |
| 124 | }; |
| 125 | } |
| 126 | |
| 127 | /** Clamp horizontal reveal against the narrowest code viewport in the active layout. */ |
| 128 | export function resolveCodeViewportWidth( |
no outgoing calls
no test coverage detected