Fix Pi inline image rendering - #270
Merged
Merged
Conversation
simion
approved these changes
Aug 28, 2026
simion
left a comment
Owner
There was a problem hiding this comment.
Thanks for tracking this down, merging.
Owner
|
@Ancientkingg implementing now first party support for |
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.
Pi can render inline images through iTerm2’s image protocol, but several issues prevented that from working reliably in Termic.
The IIP decoder in
@xterm/addon-imageuses WebAssembly, which WKWebView could not initialize under the existing CSP. Termic could also inherit variables from the terminal that launched it, such as Ghostty or Kitty markers. Pi would detect those variables and emit Kitty graphics even though Termic advertises iTerm2 compatibility.Once an image rendered, Pi’s alternate-screen redraws could clear the xterm cell metadata associated with it, causing the image to disappear. This change allows the decoder to initialize, removes inherited terminal-host markers before spawning the PTY, and preserves image metadata during Pi’s full-line redraws. The redraw workaround is limited to Pi sessions.
Images can still look soft on Retina displays. That is a separate issue in
@xterm/addon-image, where the canvas is rendered at CSS resolution rather than device resolution. xterm.js PR #5775 addresses this upstream for IIP, SIXEL, and Kitty images. Termic can adopt that improvement once it is released instead of carrying another local patch.After this change:
The same prompt in the current Termic release:
I opened a Pi session in Termic on macOS and confirmed that images remained visible through repeated redraws