Redraw inline images (iTerm2) and clear them on unmount - #13
Merged
Conversation
The iterm2 inline-image format (real iTerm2 and VS Code) doesn't integrate with Ink's frame lifecycle the way kitty/ghostty do (no graphics plane, no image IDs to double-buffer). - Real iTerm2/sixels: the image lives in the text grid, so the host app's normal Ink repaints (e.g. a live price ticker) erase it, and this component doesn't re-render on those. Re-stamp the cached image on a 120ms interval so it survives. Some flicker is inherent — without image IDs there's no atomic swap like kitty. Skipped for VS Code (its images persist and would stack). - On unmount (switching to a table/log view), paint the image's exact cells black so the replacement view draws over a clean region instead of the lingering chart. Kitty still deletes its buffered image IDs. Inline draws now use absolute positioning (like kitty) so the same coords drive the draw, the redraw interval, and the unmount clear. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SCHVP8VywU8i8JAN4xgLVs
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.
Follow-up to the graphics-lifecycle fixes, covering the
iterm2inline-image format (real iTerm2 + VS Code), which — unlike kitty/ghostty — has no graphics plane or image IDs to double-buffer.Real iTerm2 — chart vanished 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) erase it, and this component doesn't re-render on those, so nothing redraws it. Fix: re-stamp the cached image on a 120ms interval while mounted. Some flicker is inherent (no image IDs = no atomic swap like kitty); this was accepted as far better than falling back to the chafa look. Skipped for VS Code (its images persist and would stack).
VS Code — chart ghosted over table/log view
VS Code's inline image persists over later text and has no delete command. Fix: on unmount, paint the image's exact cells black so the host's next repaint draws the replacement view over a clean region. (Best-effort for VS Code, which is a non-critical target.)
Inline draws now use absolute positioning (like kitty) so the same coordinates drive the draw, the redraw interval, and the unmount clear. Kitty/ghostty unchanged (still delete buffered image IDs on unmount).
Verification
🤖 Generated with Claude Code