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

Function makeFrame

src/ink/tmuxResetSequence.test.ts:89–134  ·  view source on GitHub ↗
({
  lines,
  viewportWidth = 10,
  viewportHeight,
  screenHeight = lines.length,
  cursorY = screenHeight,
}: {
  lines: string[]
  viewportWidth?: number
  viewportHeight: number
  screenHeight?: number
  cursorY?: number
})

Source from the content-addressed store, hash-verified

87}
88
89function makeFrame({
90 lines,
91 viewportWidth = 10,
92 viewportHeight,
93 screenHeight = lines.length,
94 cursorY = screenHeight,
95}: {
96 lines: string[]
97 viewportWidth?: number
98 viewportHeight: number
99 screenHeight?: number
100 cursorY?: number
101}): Frame {
102 const screen = createScreen(
103 viewportWidth,
104 screenHeight,
105 stylePool,
106 charPool,
107 hyperlinkPool,
108 )
109
110 for (let y = 0; y < lines.length; y += 1) {
111 const line = lines[y] ?? ''
112 for (let x = 0; x < line.length; x += 1) {
113 setCellAt(screen, x, y, {
114 char: line[x]!,
115 styleId: stylePool.none,
116 width: CellWidth.Narrow,
117 hyperlink: undefined,
118 })
119 }
120 }
121
122 return {
123 screen,
124 viewport: {
125 width: viewportWidth,
126 height: viewportHeight,
127 },
128 cursor: {
129 x: 0,
130 y: cursorY,
131 visible: true,
132 },
133 }
134}
135
136async function runResetCapture(
137 reason: 'resize' | 'offscreen',

Callers 1

Calls 2

createScreenFunction · 0.85
setCellAtFunction · 0.85

Tested by

no test coverage detected