hermes-agent/ui-opentui
alt-glitch 0a5b0780f5 opentui(v6): clamp negative draw coords at the node:ffi seam (diff crash fix)
Expanding a tall <diff showLineNumbers> pinned to the scrollbox bottom froze
the TUI with ERR_INVALID_ARG_VALUE looping out of CliRenderer.loop every
frame. Root cause: @opentui/core 0.4.0 marshals OptimizedBuffer
fillRect/drawText/setCell* coordinates as u32 in the FFI table while
LineNumberRenderable.renderSelf passes raw screen coordinates — NEGATIVE when
the diff is partially scrolled above the viewport. Bun's FFI silently wraps
negatives (native side bounds-checks them into a no-op); Node's experimental
node:ffi rejects them. bufferDrawBox already uses i32, which is why ordinary
boxes/text scroll fine and only the diff line-background path crashed.

Fix at the seam we own: boundary/ffiSafe.ts patches OptimizedBuffer to clip
fillRect to the non-negative quadrant and skip negative-origin
drawText/setCell*/drawChar before the FFI call (Bun parity). Installed from
boundary/renderer.ts (live) and test/lib/render.ts (headless). TODO(upstream):
widen those FFI params to i32 so this shim can be deleted.
2026-06-10 18:48:51 +05:30
..
scripts feat(tui): run on Node 26 (one runtime), finalize copy UX, rename to ui-opentui 2026-06-09 16:16:48 +00:00
src opentui(v6): clamp negative draw coords at the node:ffi seam (diff crash fix) 2026-06-10 18:48:51 +05:30
.gitignore feat(tui): run on Node 26 (one runtime), finalize copy UX, rename to ui-opentui 2026-06-09 16:16:48 +00:00
.prettierrc feat(tui): run on Node 26 (one runtime), finalize copy UX, rename to ui-opentui 2026-06-09 16:16:48 +00:00
eslint.config.mjs feat(tui): run on Node 26 (one runtime), finalize copy UX, rename to ui-opentui 2026-06-09 16:16:48 +00:00
package-lock.json feat(tui): run on Node 26 (one runtime), finalize copy UX, rename to ui-opentui 2026-06-09 16:16:48 +00:00
package.json feat(tui): run on Node 26 (one runtime), finalize copy UX, rename to ui-opentui 2026-06-09 16:16:48 +00:00
tsconfig.json feat(tui): run on Node 26 (one runtime), finalize copy UX, rename to ui-opentui 2026-06-09 16:16:48 +00:00
vitest.config.ts feat(tui): run on Node 26 (one runtime), finalize copy UX, rename to ui-opentui 2026-06-09 16:16:48 +00:00