feat: inline images in terminals (iTerm2 OSC 1337)

Images sent with the iTerm2 inline protocol (imgcat and friends) are
decoded (PNG, JPEG, GIF first frame) and drawn at the cursor, sized from
the width/height arguments in cells, pixels or percent (aspect kept,
never wider than the terminal); the cursor moves below so text
continues after them. They are anchored to the same stable line index
as the shell-integration marks, scroll with the text and are dropped
with the scrollback or on clear.

Remote data, so decoding is bounded (8192 px a side, 256 MiB
allocation), OSC bodies are capped at 16 MiB, inline=0 downloads are
ignored, and each terminal keeps at most 32 Mpx of images, oldest
first. Sixel and kitty graphics are not implemented.
This commit is contained in:
Andy Dixon
2026-10-12 18:47:07 +01:00
parent f80fc876dd
commit 469acb1203
6 changed files with 187 additions and 3 deletions
+4
View File
@@ -218,6 +218,10 @@ A new pane offers **Local Machine** and your terminal profiles (SSH, Telnet and
## 6. Terminal actions and search
### Inline images
Programs that print images in the iTerm2 format (`imgcat`, `wezterm imgcat`, `chafa -f iterm`) show PNG, JPEG and GIF (first frame) images inline, sized as the program asks and never wider than the terminal; the text continues below the image. Images scroll with the text and are dropped with the scrollback. Very large images (over 8192 pixels a side) are ignored, and each terminal keeps at most 32 megapixels of images, dropping the oldest. Sixel and kitty graphics aren't supported.
### Shell integration
When the shell marks its prompts and commands (the OSC 133 sequences), Nexus Terminal knows where each command starts and ends: