fix: render blank bootstrap state on open() and reset()#2
Open
aliceisjustplaying wants to merge 1 commit intorcarmo:mainfrom
Open
fix: render blank bootstrap state on open() and reset()#2aliceisjustplaying wants to merge 1 commit intorcarmo:mainfrom
aliceisjustplaying wants to merge 1 commit intorcarmo:mainfrom
Conversation
Without this fix, opening or resetting a terminal renders uninitialised WASM memory instead of a clean blank screen. This is visible as garbled characters or stale content flashing briefly before the first real write. Uses the existing SnapshotBuffer infrastructure to inject a blank-cell snapshot (theme-coloured spaces) that the renderer paints until the first writeInternal() call clears it. The bootstrap snapshot is distinguished from playback snapshots by the absence of a cursor position, so the two features do not interfere with each other. Changes: - parseCssColorToRgb(): parse theme hex/rgb strings into numeric values - createBlankBootstrapCells(): build a blank cell grid from theme colors - armBootstrapBlank(): set the blank snapshot on open() and reset() - disarmBootstrapBlank(): clear on first write(), no-op during playback
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Opening or resetting a terminal briefly renders uninitialised WASM memory — visible as garbled characters or stale content flashing before the first real write arrives.
Fix
Uses the existing
SnapshotBufferinfrastructure (added for playback mode) to inject a blank-cell snapshot onopen()andreset(). The snapshot contains theme-coloured space characters so the canvas shows a clean blank screen until the firstwriteInternal()call clears it.How bootstrap snapshots coexist with playback snapshots
Bootstrap blanks are set without a cursor (
snapshotCursorstaysnull), while playback snapshots always include a cursor position viasetSnapshot().disarmBootstrapBlank()checks for this and is a no-op when a playback snapshot is active, so the two features don't interfere.Changes
parseCssColorToRgb()createBlankBootstrapCells()GhosttyCell[][]grid of blank cells using theme coloursarmBootstrapBlank()open()andreset()disarmBootstrapBlank()write(); no-op during playbackIntegration points
open()— arms before initial renderreset()— re-arms after creating new WASM terminal, renders blank immediatelywriteInternal()— disarms on first write so renderer switches to live WASM outputsnapshotBuffer, no changes neededPix (PiClaw, claude-opus-4-6)