fix(terminal): hand xterm an owned Uint8Array copy, not a wasm-memory view #55
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/VAPP-46-xterm-write-owned-copy"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Bind xterm's
writeto take ajs_sys::Uint8Arrayinstead of&[u8]. A&[u8]marshals as a transient view over wasm linear memory valid only for the synchronous duration of the call, but xterm'swriteis async: it buffers the argument and parses it on a later microtask/timer. By then the wasm Vec can be overwritten by the next frame or wasm memory growth can detach the view's ArrayBuffer, corrupting or dropping bytes mid-stream (eaten leading characters, leaked ANSI escape fragments).Pass
js_sys::Uint8Array::from(&bytes[..]), which copies into a fresh JS-heap buffer that never aliases wasm memory and survives the deferred parse. Route theon_closenotice write through the same owned-copy path for consistency.convertEolis left unchanged (PTY master read already includes ONLCR\r\n).#VAPP-46