Repository navigation
Report cell pixel size in the PTY window size and enable all kitty mediums - #686
Merged
Merged
Conversation
emil-e
approved these changes
Sep 14, 2026
| cwd: ?[:0]const u8 = null, | ||
| }; | ||
|
|
||
| /// PTY window size. ConPTY has no pixel geometry and ignores the pixel fields. |
The POSIX PTY backend set ws_xpixel and ws_ypixel to zero in TIOCSWINSZ. Tools that size kitty graphics from TIOCGWINSZ (broot, ranger) treat zero pixel fields as "no cell size available" and fall back to text rendering. Carry a WinSize struct (cols, rows, xpixel, ypixel) from GhostelTerm through NativeProcess to the backends, filled from libghostty's width_px/height_px. GhostelTerm tracks the last size sent to the native PTY and resends after a redraw whenever the grid or the pixel geometry changed, so DPI and cell-scale changes propagate too. The Emacs-owned PTY path is unchanged: set-process-window-size cannot carry pixels. Fixes #675
ghostel-kitty-graphics-mediums defaults to (file temp-file shared-mem), matching Ghostty and kitty. broot and ranger transmit images through the file and temp-file mediums, so previews work without configuration. nil keeps the inline-only behavior.
dakra
force-pushed
the
fix/pty-winsize-pixels
branch
from
September 14, 2026 11:14
5d9046c to
7531ba4
Compare
marcuslannister
added a commit
to marcuslannister/emacs.d
that referenced
this pull request
Sep 15, 2026
MELPA `ghostel` 20260915.554 (commit f1b03e52c4) carries dakra/ghostel#686, which fixes purcell#677 (zero ws_xpixel/ws_ypixel on the native PTY). The local adjustWidth cursor-cell patch applies unchanged on v0.54.0.
This branch was successfully deployed
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.
Fixes #675.
The reporter's "corrupted" broot preview is broot's half-block text fallback, which it uses when it cannot determine the cell pixel size. Two ghostel-side causes:
ws_xpixel/ws_ypixelto 0 inTIOCSWINSZ. broot (≤ 1.58, the nixpkgs stable version) readsTIOCGWINSZonly and disables kitty graphics on zero pixel fields; ranger reads it too.ghostel-kitty-graphics-mediumsdefaulted to nil, so broot's default temp-file / file transmissions were refused withEINVAL: unsupported medium. broot sendsq=2and never sees the refusal.Changes:
WinSizestruct (cols, rows, xpixel, ypixel) flows fromGhostelTermthroughNativeProcessto the PTY backends, filled from libghostty'swidth_px/height_px.GhostelTermtracks the last size sent to the native PTY and resends after a redraw when the grid or the pixel geometry changed, so DPI and cell-scale changes propagate too. The Emacs-owned PTY path is unchanged (set-process-window-sizecannot carry pixels). ConPTY ignores the pixel fields.ghostel-kitty-graphics-mediumsdefaults to(file temp-file shared-mem), as in Ghostty and kitty. nil keeps the inline-only behavior.TIOCGWINSZand sees the spawn-time seed and a 9×23 resize as720×552px.Verified in a live GUI Emacs: a child sees
WINSZ (33, 100, 1100, 726), consistent with the CSI 16 t reply, and a broot-stylet=ttransmit returnsOKand renders.Not covered: ranger's capability probe sends
S=3and hits the libghostty exact-size read bug (upstream ghostty-org/ghostty#12901, fixed in ghostty abd77067d), so ranger still needs a libghostty bump. ranger also requiresTERMto contain "kitty".