Skip to content

fix: render blank bootstrap state on open() and reset()#2

Open
aliceisjustplaying wants to merge 1 commit intorcarmo:mainfrom
aliceisjustplaying:fix/bootstrap-blank-render
Open

fix: render blank bootstrap state on open() and reset()#2
aliceisjustplaying wants to merge 1 commit intorcarmo:mainfrom
aliceisjustplaying:fix/bootstrap-blank-render

Conversation

@aliceisjustplaying
Copy link
Copy Markdown

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 SnapshotBuffer infrastructure (added for playback mode) to inject a blank-cell snapshot on open() and reset(). The snapshot contains theme-coloured space characters so the canvas shows a clean blank screen until the first writeInternal() call clears it.

How bootstrap snapshots coexist with playback snapshots

Bootstrap blanks are set without a cursor (snapshotCursor stays null), while playback snapshots always include a cursor position via setSnapshot(). disarmBootstrapBlank() checks for this and is a no-op when a playback snapshot is active, so the two features don't interfere.

Changes

Function Purpose
parseCssColorToRgb() Parse theme hex/rgb strings into numeric r,g,b for cell construction
createBlankBootstrapCells() Build a GhosttyCell[][] grid of blank cells using theme colours
armBootstrapBlank() Set the blank snapshot — called on open() and reset()
disarmBootstrapBlank() Clear the snapshot on first write(); no-op during playback

Integration points

  • open() — arms before initial render
  • reset() — re-arms after creating new WASM terminal, renders blank immediately
  • writeInternal() — disarms on first write so renderer switches to live WASM output
  • render loop — already uses snapshotBuffer, no changes needed

Pix (PiClaw, claude-opus-4-6)

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant