a73x

Wire libghostty-vt effect callbacks (WRITE_PTY, TITLE_CHANGED, etc.)

closed   by a73x

Labels: review

The vt.Terminal facade does not register any of the effect callbacks that libghostty-vt exposes. At minimum:

- WRITE_PTY: mandatory. Without this, the terminal cannot respond to device status queries (DSR, cursor position reports). Breaks vim cursor tracking, any program that queries the terminal.
- TITLE_CHANGED: so OSC 0 / OSC 2 sequences update the xdg_toplevel title. Without this, vim/tmux titles never appear.
- DEVICE_ATTRIBUTES: respond to DA1/DA2/DA3 queries. Breaks programs that need to know terminal capabilities.
- SIZE: respond to size queries.
- XTVERSION: return 'waystty'.
- COLOR_SCHEME: stub returning false.

Implementation notes:
- The exact Zig API for registering callbacks is in ghostty-vt's Terminal options or via setters — see example/zig-vt/src/main.zig in the ghostty repo
- WRITE_PTY callback needs a context pointer back to pty.Pty to call p.write()
- This has to be wired in vt.Terminal.init (which means threading the pty through, or using a late-bound setter)

Ref: plan Corrections section C3 and spec vt.zig section.

Close reason: [claude 2026-04-08] Fixed by merged replacement patch 08e8e3f7.

Comments

a73x   2026-04-08T13:03:47.778749011+00:00

[claude 2026-04-08] Picking this up next. Plan: trace the current libghostty-vt render/effect surface, add the smallest missing wiring, and cover it with focused tests before moving on.

a73x   2026-04-08T13:03:58.423107788+00:00

[claude 2026-04-08] Picking this up next. Plan: trace the libghostty-vt render/effect surface, identify the minimal missing callback wiring in waystty, then land the smallest test-backed integration.

a73x   2026-04-08T13:09:35.605568941+00:00

[claude 2026-04-08] Local fix is in place and verified with `zig build test` (26/26). The vt wrapper now wires WRITE_PTY/TITLE_CHANGED/SIZE/DEVICE_ATTRIBUTES/XTVERSION/COLOR_SCHEME effects through its stream handler, main installs PTY/title/size hooks, and the callback tests now explicitly cover cursor-position reports, title updates including empty-title clears, size reports, XTVERSION, and DA1 responses.

a73x   2026-04-08T13:09:48.935048832+00:00

[claude 2026-04-08] Committed locally as b2d1bc2 (`Wire terminal effect callbacks`). Moving on to the next issue while this sits ready for patch/review.