Skip to content

fix: honest SGR-Pixels (DECSET 1016) into nested child PTYs - #1

Draft
SLatz18 wants to merge 7 commits into
masterfrom
cursor/sgr-pixels-child-pty-0a95
Draft

fix: honest SGR-Pixels (DECSET 1016) into nested child PTYs#1
SLatz18 wants to merge 7 commits into
masterfrom
cursor/sgr-pixels-child-pty-0a95

Conversation

@SLatz18

@SLatz18 SLatz18 commented Sep 3, 2026

Copy link
Copy Markdown
Owner

Honest SGR-Pixels (DECSET 1016) into ordinary nested child PTYs.

Behavior is unchanged. This revision only shrinks the PR surface for upstreamability.

Kept

  1. Host 1016 follows the focused child's encoding, not kitty-graphics demand.
  2. Encode as SGR-Pixels when mode 1016 is SET, even after a later Bubble Tea 1006h (the Col-1 collapse).
  3. Host↔pane mapping uses true cell pitch: snap ioctl leftover (ws_xpixel − cols × cell) off the extent so index * extent / cols is index * cell. Prefer CSI 16 t when it fits. Ghostty SGR-Pixels is already terminal-space.

Deleted vs earlier revisions

  • HostAxis / parallel boundary APIs / cell_origin_pixel — mapping snaps padding in HostGeometry::new instead
  • Handshake wrappers (advertised_pixel_mouse, pixel_geometry_collection_enabled) — inlined the one ioctl-collection change; hello pixel_mouse is back to exact_cell_size && cfg!(unix)
  • Debug traces on child encode
  • Duplicate ClientShell/headless harnesses (sidebar compose helper, col-4 click copies, remote/file-frame advertising tests)

Issues

Tests kept

  • Col-4 cell input encodes \x1b[<0;41;1M / motion \x1b[<35;41;121M, not cell 5
  • 1006h then 1016h then 1006h still encodes pixels
  • Padded ioctl 1276/127, cell 10: late-column click stays in the right half
  • Integer cell pitch does not stretch leftover padding
  • Host 1016 follows child 1016, not a graphics layer
  • CSI 16 t query follows pixel geometry, not kitty-graphics

cargo fmt, clippy -D warnings, focused nextest (21) green.

Size

  • Before slim: +785 / −64 (17 files)
  • After slim: +181 / −44 (13 files)

Out of scope

herdrdev#3480, plugins, markedit2d, ME2D_PX_CAL.

Do not merge. Fork PR because this account is not a herdrdev maintainer / approved contributor.

Open in Web Open in Cursor 

cursoragent and others added 7 commits September 3, 2026 23:26
Host 1016 now follows the focused child's encoding instead of kitty
graphics demand, so ordinary nested TUIs get pane-local pixels. Cell
input while 1016 is SET is promoted using TIOCGWINSZ cell size.
pixel_mouse stays independent of is_remote_client_process / file-frame.

refs herdrdev#3074

Co-authored-by: Scott Latz <SLatz18@users.noreply.github.com>
Host SGR 1016 no longer consults pane graphics layers, so
active_for_pane is unused and trips -D warnings.

Co-authored-by: Scott Latz <SLatz18@users.noreply.github.com>
Client-shell mapping uses real host chrome geometry. Headless pane
input returns false when it does not request a re-render; assert the
encoded PTY bytes instead.

Co-authored-by: Scott Latz <SLatz18@users.noreply.github.com>
refs herdrdev#3074

Co-authored-by: Scott Latz <SLatz18@users.noreply.github.com>
Bubble Tea re-sends DECSET 1006 after the child enables 1016. Ghostty's
mouse_format flag then becomes SGR while mode 1016 stays SET, so the
encoder converted pane-local pixels back to cell indices. Nested TUIs
interpreted those cells as pixels and collapsed to column 1.

refs herdrdev#3074

Co-authored-by: Scott Latz <SLatz18@users.noreply.github.com>
Ghostty's ws_xpixel includes window padding, so index * extent / cols
stretches the modeled pitch (~10.048 vs 10). Forwarded pixels slip left,
worse across the line. Prefer CSI 16 t cell size and map with
index * cell, treating leftover as a fixed inset.

refs herdrdev#3074

Co-authored-by: Scott Latz <SLatz18@users.noreply.github.com>
Keep honest child-PTY 1016, encode-as-pixels after a later 1006h, and
true cell pitch (ioctl leftover is a fixed inset). Drop HostAxis,
handshake wrappers, debug traces, and duplicate ClientShell/headless
tests.

refs herdrdev#3074

Co-authored-by: Scott Latz <SLatz18@users.noreply.github.com>
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.

2 participants