[v0.1/Protocol] Implement in-band resize notify (?2048) #189

Closed
opened 2026-09-07 16:33:18 +09:00 by natsukium · 0 comments
Owner

What

Implement in-band resize notification, DEC private mode ?2048: while a program has set the mode, the terminal pushes
CSI 48 ; <rows> ; <cols> ; <height_px> ; <width_px> t to the PTY whenever the session geometry changes, and answers
the set with one immediate report so the program learns the current size without a separate query.

#181 recorded the stance: adopt. felis's geometry is daemon-owned and changes from several directions a program
cannot observe (window resize, sessions retarget, a second attached client), which is exactly the case in-band
notification serves better than SIGWINCH alone. Window-size reporting stays out: CSI 14/15/16 t remain stubbed
0;0 and XTWINOPS stays a non-goal — ?2048 is a notification the program opts into, not a query that leaks host
geometry.

Where

  • crates/felis-grid/src/sink.rs: the mode set/reset arm beside 2031 => self.color_scheme_notify = on, plus the
    DECRQM report in crates/felis-grid/src/editing.rs (the 2031 arm there is the model).
  • crates/felis-grid/src/lib.rs: the mode flag and its accessor, mirroring color_scheme_notify().
  • crates/felis-daemon/src/serve/session_task.rs: emit the report on every effective geometry change while the mode is
    set, and once on the set itself. The color-scheme notify path (around the color_scheme_notify() call site) is the
    plumbing template. The pixel axes report 0 where the daemon has no window extents, matching the CSI 14 t stub.

Tests

  • crates/felis-grid/tests/snapshot_csi.rs: the immediate report on set, no report while unset, and DECRQM reporting
    the mode.
  • A daemon test in crates/felis-daemon/src/serve/session_task.rs's test module: a resize while the mode is set writes
    one report to the PTY; the same resize with the mode unset writes nothing.

Cascade

docs/reference/protocols/support-matrix.md (row flips to ), docs/reference/protocols/vt-compliance.md
"Reporting and queries", the landscape stance line from #181, and CHANGELOG.md (a new sequence programs can rely on).

Split from #181.

## What Implement in-band resize notification, DEC private mode `?2048`: while a program has set the mode, the terminal pushes `CSI 48 ; <rows> ; <cols> ; <height_px> ; <width_px> t` to the PTY whenever the session geometry changes, and answers the set with one immediate report so the program learns the current size without a separate query. #181 recorded the stance: **adopt**. felis's geometry is daemon-owned and changes from several directions a program cannot observe (window resize, `sessions retarget`, a second attached client), which is exactly the case in-band notification serves better than SIGWINCH alone. Window-size *reporting* stays out: `CSI 14/15/16 t` remain stubbed `0;0` and XTWINOPS stays a non-goal — `?2048` is a notification the program opts into, not a query that leaks host geometry. ## Where - `crates/felis-grid/src/sink.rs`: the mode set/reset arm beside `2031 => self.color_scheme_notify = on`, plus the DECRQM report in `crates/felis-grid/src/editing.rs` (the `2031` arm there is the model). - `crates/felis-grid/src/lib.rs`: the mode flag and its accessor, mirroring `color_scheme_notify()`. - `crates/felis-daemon/src/serve/session_task.rs`: emit the report on every effective geometry change while the mode is set, and once on the set itself. The color-scheme notify path (around the `color_scheme_notify()` call site) is the plumbing template. The pixel axes report `0` where the daemon has no window extents, matching the `CSI 14 t` stub. ## Tests - `crates/felis-grid/tests/snapshot_csi.rs`: the immediate report on set, no report while unset, and DECRQM reporting the mode. - A daemon test in `crates/felis-daemon/src/serve/session_task.rs`'s test module: a resize while the mode is set writes one report to the PTY; the same resize with the mode unset writes nothing. ## Cascade `docs/reference/protocols/support-matrix.md` (row flips to `✅`), `docs/reference/protocols/vt-compliance.md` "Reporting and queries", the landscape stance line from #181, and `CHANGELOG.md` (a new sequence programs can rely on). Split from #181.
Sign in to join this conversation.
No description provided.