(viewport: TestViewport | undefined)
| 115 | type ClipRect = Readonly<{ x: number; y: number; w: number; h: number }>; |
| 116 | |
| 117 | function normalizeViewport(viewport: TestViewport | undefined): TestViewport { |
| 118 | const cols = viewport?.cols ?? 80; |
| 119 | const rows = viewport?.rows ?? 24; |
| 120 | const safeCols = Number.isFinite(cols) ? Math.max(0, Math.trunc(cols)) : 0; |
| 121 | const safeRows = Number.isFinite(rows) ? Math.max(0, Math.trunc(rows)) : 0; |
| 122 | return Object.freeze({ cols: safeCols, rows: safeRows }); |
| 123 | } |
| 124 | |
| 125 | function normalizeTheme(theme: Theme | ThemeDefinition | undefined): Theme { |
| 126 | if (theme === undefined) return coreDefaultTheme; |
no outgoing calls
no test coverage detected