fix: prevent terminal crash on resize during high-output programs master
Cancel the render loop before WASM resize to prevent accessing detached TypedArray views when buffers are reallocated. Restart render loop and flush any queued writes synchronously after resize completes. This avoids the background-tab regression from PR #114's approach of using an isResizing flag cleared via requestAnimationFrame (rAF is throttled/paused in background tabs, causing writes to queue indefinitely). Changes: - terminal.ts: Add cancelRenderLoop()/flushWriteQueue(), wrap resize() in try/catch with render loop pause/restart, add defensive writeQueue - ghostty.ts: Invalidate grapheme buffers in invalidateBuffers() alongside viewport buffers to prevent stale TypedArray access Co-authored-by: 0xBigBoss <95193764+0xBigBoss@users.noreply.github.com>