MCPcopy Create free account
hub / github.com/Noumena-Network/code / screenToRows

Function screenToRows

src/ink/terminalReplayOracle.ts:303–313  ·  view source on GitHub ↗
(screen: Screen)

Source from the content-addressed store, hash-verified

301}
302
303export function screenToRows(screen: Screen): string[] {
304 const rows: string[] = []
305 for (let y = 0; y < screen.height; y += 1) {
306 let row = ''
307 for (let x = 0; x < screen.width; x += 1) {
308 row += cellAt(screen, x, y)?.char ?? ' '
309 }
310 rows.push(row)
311 }
312 return rows
313}
314
315function normalizeRow(value: string, width: number): string[] {
316 return [...value.padEnd(width, ' ').slice(0, width)]

Calls 1

cellAtFunction · 0.85

Tested by

no test coverage detected