Report terminal pixel size so Kitty/icat pixel probes succeed#138
Merged
Conversation
A pane's PTY winsize and XTWINOPS size reports carried 0x0 pixel dimensions until a client announced a viewport with usable pixel metrics. Most clients report cells but not pixels, so the geometry stayed zero and pixel-aware programs refused to run: `kitten icat` preflights with "Terminal does not support reporting screen sizes in pixels" and aborts before sending any image. Seed a fallback per-cell pixel size (DEFAULT_CELL_PX = 8x16) so the derived pixel geometry is never zero. Cells (cols/rows) stay authoritative; pixels are always cells x cell size. A real client's reported cell size still wins and remains sticky across pixel-less resizes. Applied at three reporting sites: - spawn-time openpty winsize (a child reading TIOCGWINSZ before any resize now sees nonzero pixels), - the initial size_report cell shared with libghostty's on_size callback (so CSI 14 t answers nonzero before the first resize), - handle_resize, which already derives winsize and size reports from the now-nonzero sticky cell size. This is the pixel-size REPORTING fix only; full Kitty graphics rendering is a separate deferred item. No wire change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Problem
kitty +kitten icataborts before sending any image with:icat preflights the terminal for PIXEL dimensions. A phux pane reported
0x0: the PTY winsizews_xpixel/ws_ypixeland the XTWINOPSCSI 14 treply both derived their pixels from a per-cell size that stayed(0, 0)until a client announced a viewport with usable pixel metrics. Most clients report cells but not pixels, so the geometry stayed zero and the probe failed.Fix (pixel-size REPORTING only)
Seed a fallback per-cell pixel size
DEFAULT_CELL_PX = 8x16so the derived pixel geometry is never zero. Cells (cols/rows) remain authoritative; pixels are alwayscells x cell size. A real client's reported cell size still wins and stays sticky across pixel-less resizes (e.g. an agentTERMINAL_RESIZE).Applied at the three reporting sites in
phux-server:openptywinsize — a child that readsTIOCGWINSZbefore any client resize (icat preflighting at shell startup) now sees nonzero pixels.size_reportshared with libghostty'son_sizecallback —CSI 14 tanswers nonzero even before the first resize.handle_resize— already derives the winsize ioctl and size reports from the sticky cell size, now nonzero.The in-band
CSI 14 t/CSI 16 t/CSI 18 tpath is already wired through libghostty'son_sizecallback (exercised byxtwinops_size_queries_answered_from_resized_geometry); it simply needed a nonzero cell size to report, which this change guarantees.Server-local; no wire change — no spec update or version bump required.
Scope
This is the pixel-size REPORTING fix only. Full Kitty graphics RENDERING is a separate deferred item with its own ADR and is not attempted here.
Tests
winsize_pixels_default_when_no_client_reports_metrics: with no client ever reporting pixel metrics, asserts spawn-time winsize is80x24 cells -> 640x384 pxand a pixel-less resize tracks100x40 -> 800x640 px.resize_with_cell_px_updates_pty_winsize_pixelsandxtwinops_size_queries_answered_from_resized_geometrycontinue to pass (client-reported cell size still wins).just cigreen locally.🤖 Generated with Claude Code