Skip to content

fix(pi-tui): prefer iTerm2 inline images over kitty on WezTerm - #2539

Open
nothankyouzzz wants to merge 2 commits into
MoonshotAI:mainfrom
nothankyouzzz:fix/wezterm-inline-image
Open

fix(pi-tui): prefer iTerm2 inline images over kitty on WezTerm#2539
nothankyouzzz wants to merge 2 commits into
MoonshotAI:mainfrom
nothankyouzzz:fix/wezterm-inline-image

Conversation

@nothankyouzzz

Copy link
Copy Markdown

Related Issue

Resolve #2538

Problem

See linked issue. On WezTerm, inline images in the transcript (e.g. pasted image thumbnails) degrade to a one-row sliver: the vendored pi-tui emits a one-shot, cell-anchored kitty placement, and WezTerm drops image content wherever transcript redraws rewrite text rows over it (wezterm#986).

What changed

  • detectCapabilities() in packages/pi-tui now reports the iTerm2 inline-image protocol for WezTerm instead of kitty. iTerm2 images are attached to the emitting line and scroll with the buffer, so they survive the transcript's redraw model.
  • Added a detection test for the WezTerm branch.

Why this approach: current upstream @earendil-works/pi-tui (0.83.0) solves the same class of problem with scroll-aware kitty cropping (cropKittyImageLine), but that machinery hangs off upstream's new layout.ts renderer, which the vendored snapshot does not have — backporting it would mean rewriting the renderer. Preferring iTerm2 on WezTerm is a one-branch change, uses a protocol WezTerm natively supports, and was verified end-to-end: thumbnails render fully and survive scrolling. The vendored fork keeps kitty for kitty/ghostty/warp, where cell-anchored placement works.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

WezTerm's cell-anchored kitty placement loses image content wherever
text rows are (re)written over it; a scrolling transcript constantly
rewrites rows, so pasted screenshots degrade to a one-row sliver
(wezterm#986). Its iTerm2 inline images are line-attached and scroll
with the buffer, surviving the diff-render redraw model.

Detect WezTerm as images: "iterm2" and register the fork divergence
in AGENTS.md.
@changeset-bot

changeset-bot Bot commented Aug 2, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 93a1c2b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@moonshot-ai/kimi-code Patch
@moonshot-ai/pi-tui Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 93a1c2b31c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/pi-tui/src/terminal-image.ts
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.

[Bug] WezTerm: inline images degrade to a one-row sliver (vendored pi-tui kitty path lacks scroll awareness)

1 participant