snow-flow 10.0.131 → 10.0.133
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/cli/cmd/tui/app.tsx +13 -37
package/package.json
CHANGED
package/src/cli/cmd/tui/app.tsx
CHANGED
|
@@ -220,47 +220,23 @@ function HostedRendererDiag() {
|
|
|
220
220
|
onMount(() => {
|
|
221
221
|
const r = renderer as any
|
|
222
222
|
const log = (msg: string) => process.stderr.write(`[sf-diag] ${msg}\n`)
|
|
223
|
-
log(`useThread=${r._useThread} isRunning=${r._isRunning} state=${r._controlState}`)
|
|
224
|
-
log(`platform=${process.platform} altScreen=${r._useAlternateScreen} termSetup=${r._terminalIsSetup}`)
|
|
225
|
-
|
|
226
|
-
// On Linux, useThread=false means Zig render() buffers ANSI but doesn't write to fd 1.
|
|
227
|
-
// Patch renderNative to manually flush the Zig stdout buffer after each render frame.
|
|
228
223
|
const realWrite = r.realStdoutWrite
|
|
229
224
|
const stdout = r.stdout
|
|
230
|
-
if (realWrite && r.lib && r.rendererPtr) {
|
|
231
|
-
const origRenderNative = r.renderNative.bind(r)
|
|
232
|
-
r.renderNative = () => {
|
|
233
|
-
origRenderNative()
|
|
234
|
-
// Try to flush Zig's internal stdout buffer by calling writeOut with empty data
|
|
235
|
-
try {
|
|
236
|
-
r.lib.writeOut(r.rendererPtr, new Uint8Array(0).buffer, 0)
|
|
237
|
-
} catch {}
|
|
238
|
-
}
|
|
239
|
-
log("patched renderNative with flush")
|
|
240
|
-
}
|
|
241
225
|
|
|
242
|
-
|
|
243
|
-
if (realWrite) {
|
|
244
|
-
realWrite.call(stdout, "\x1b[2J\x1b[H")
|
|
245
|
-
}
|
|
246
|
-
if (!r._isRunning) {
|
|
247
|
-
r.start()
|
|
248
|
-
log(`started: isRunning=${r._isRunning} state=${r._controlState}`)
|
|
249
|
-
}
|
|
226
|
+
log(`useThread=${r._useThread} isRunning=${r._isRunning}`)
|
|
250
227
|
|
|
251
|
-
//
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
}, 3000)
|
|
228
|
+
// Clear screen for clean rendering
|
|
229
|
+
realWrite?.call(stdout, "\x1b[2J\x1b[H")
|
|
230
|
+
|
|
231
|
+
// Start the render loop (it doesn't auto-start on Linux)
|
|
232
|
+
if (!r._isRunning) r.start()
|
|
233
|
+
|
|
234
|
+
// Key fix: enable Zig output thread AFTER renderer is safely initialized.
|
|
235
|
+
// On Linux, @opentui creates the renderer with useThread=false.
|
|
236
|
+
// The setter calls lib.setUseThread(ptr, true) which starts the Zig
|
|
237
|
+
// thread that drains the render output buffer and writes to fd 1.
|
|
238
|
+
r.useThread = true
|
|
239
|
+
log(`after useThread=true: useThread=${r._useThread}`)
|
|
264
240
|
})
|
|
265
241
|
return null
|
|
266
242
|
}
|