( grid: string[][], viewport: TestViewport, clipStack: readonly ClipRect[], x0: number, y: number, text: string, )
| 289 | } |
| 290 | |
| 291 | function drawTextToGrid( |
| 292 | grid: string[][], |
| 293 | viewport: TestViewport, |
| 294 | clipStack: readonly ClipRect[], |
| 295 | x0: number, |
| 296 | y: number, |
| 297 | text: string, |
| 298 | ): void { |
| 299 | if (y < 0 || y >= viewport.rows) return; |
| 300 | let x = x0; |
| 301 | for (const glyph of text) { |
| 302 | const width = measureTextCells(glyph); |
| 303 | if (width <= 0) continue; |
| 304 | |
| 305 | if (x >= 0 && x < viewport.cols && inClipStack(x, y, clipStack)) { |
| 306 | const row = grid[y]; |
| 307 | if (row) row[x] = glyph; |
| 308 | } |
| 309 | |
| 310 | for (let i = 1; i < width; i++) { |
| 311 | const xx = x + i; |
| 312 | if (xx < 0 || xx >= viewport.cols || !inClipStack(xx, y, clipStack)) continue; |
| 313 | const row = grid[y]; |
| 314 | if (row) row[xx] = " "; |
| 315 | } |
| 316 | |
| 317 | x += width; |
| 318 | } |
| 319 | } |
| 320 | |
| 321 | function fillGridRect( |
| 322 | grid: string[][], |
no test coverage detected