terminal/osc: accept iTerm2 OSC 1337 File= inline images (parser-only)#375
Draft
deblasis wants to merge 1 commit into
Draft
terminal/osc: accept iTerm2 OSC 1337 File= inline images (parser-only)#375deblasis wants to merge 1 commit into
deblasis wants to merge 1 commit into
Conversation
The OSC 1337 dispatcher already routed File=, FilePart=, FileEnd=, and MultipartFile= keys into the "unimplemented" log arm, so wintty would silently drop iTerm2 inline-image escape sequences and treat the base64 payload as text the cursor can never reach. Add parser-side handling for the single-shot File= case: - Split the value on the first ':' into options and base64 payload. - Walk the options for inline=1 (case-insensitive); reject otherwise (iTerm2 treats non-inline as a download-to-disk which has no wintty analog). - Emit a new iterm2_image_transmit OSC Command carrying the raw base64 string. Stream dispatch logs the byte count for now. Base64 decode + kitty graphics command synthesis that actually renders the image is a follow-up. Multipart (FilePart, FileEnd, MultipartFile) and geometry hints (width, height, preserveAspectRatio, size) are also follow-ups.
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.
The OSC 1337 dispatcher already routed
File=,FilePart=,FileEnd=, andMultipartFile=keys into the "unimplemented" log arm (osc/parsers/iterm2.zig:166), so wintty silently dropped iTerm2 inline-image escape sequences and treated the base64 payload as text the cursor can never reach.This PR adds parser-side handling for the single-shot
File=case.Behavior
:into options and base64 payload.inline=1(case-insensitive); reject otherwise.iTerm2 treats non-inline
File=as a download-to-disk, which has no wintty analog.iterm2_image_transmitOSCCommandcarrying the raw base64 string.Deferred to follow-ups
FilePart,FileEnd,MultipartFile.width,height,preserveAspectRatio,size.Tests
Seven new
OSC: 1337: File ...cases cover:name,size):)Inline=1Verification
zig build test -Dtest-filter=1337-> 91/92 pass, 1 skippedzig build test-lib-vt -Dtest-filter=1337-> 93/95 pass, 2 skippedzig build test-lib-vt -Dtest-filter=1337-> 93/95 pass, 2 skippedA smoke probe lives in wintty-smoke/probe-iterm2-image.ps1 (out of tree); it emits a tiny PNG via OSC 1337 and confirms the parser hit via the debug log.
Test plan