Skip to content

Fix out-of-band graphics lifecycle (kitty/iterm2/vscode) - #12

Merged
planadecu merged 1 commit into
mainfrom
fix/clear-graphics-on-unmount
Jul 14, 2026
Merged

Fix out-of-band graphics lifecycle (kitty/iterm2/vscode)#12
planadecu merged 1 commit into
mainfrom
fix/clear-graphics-on-unmount

Conversation

@planadecu

@planadecu planadecu commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Out-of-band graphics (kitty/ghostty/iterm2/sixels) are written straight to the terminal, outside Ink's frame diff, so they don't clear or redraw with Ink's lifecycle. Different terminals fail differently. This fixes all three observed cases (verified in glassnode-terminal).

1. Kitty / ghostty — chart ghosts after leaving chart view

Kitty images live in a separate graphics plane that text repaints never erase; the double-buffer only deletes the previous image on the next render, which never comes once the chart unmounts. Fix: delete both buffered image IDs on unmount.

2. Real iTerm2 — chart vanishes after a moment

The inline image lives in the text grid, so the host app's normal Ink repaints (e.g. a live price ticker — measured ~1400 eraseLines in a few seconds) erase it, and the component doesn't re-render on those, so nothing redraws it. Fix: re-stamp the cached image on a 120ms interval while mounted.

3. VS Code — chart ghosts over table/log view

VS Code's inline image persists over later text instead of erasing. Inline images have no delete command, so fix: blank the exact cells the image occupied, on unmount. The redraw interval from (2) is scoped out for VS Code (its images persist and would stack).

Inline draws now use absolute positioning (like kitty) so the same coordinates drive the draw, the redraw interval, and the unmount blank.

Verification

  • Kitty/ghostty: confirmed fixed in glassnode-terminal (chart clears on view switch).
  • iTerm2/VS Code: escape-stream verified (image re-stamped ~16×/2s in chart view; interval stops + 32 blank-cell writes on unmount). Visual confirmation in those terminals pending.

🤖 Generated with Claude Code

Kitty/ghostty images live in a separate graphics plane that text repaints
never erase, and the double-buffer only deletes the previous image on the
next render. When the host app unmounts the chart (e.g. switching to a
table or log view), no further render happens, so the last chart lingered
on screen over whatever replaced it. Add an unmount cleanup that deletes
both buffered kitty image IDs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SCHVP8VywU8i8JAN4xgLVs
@planadecu
planadecu merged commit 24b0815 into main Jul 14, 2026
2 checks passed
@planadecu planadecu changed the title Clear out-of-band graphics on unmount Fix out-of-band graphics lifecycle (kitty/iterm2/vscode) Jul 14, 2026
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