VT Extension: In-band resize notifications
Feature Request
Summary
Consider implementing a new VT Extension for In-band resize notifications. This extension is a new private mode which enables the automatic reporting of window size changes via an escape sequence as an alternative to SIGWINCH.
Alternatives
The primary alternative to this is a SIGWINCH signal handler. SIGWINCH is reliable, but can cause race conditions as there is now a third party (the kernel) introduced which delivers the signal from the terminal to the application on it's own schedule, from a different thread than the application is operating on.
A secondary alternative is to poll the terminal with size requests (CSI 18 t). This has the obvious drawback of requiring polling.
Concerns
This is a relatively simple extension, as the information is already reported to the kernel. It should have a minimal performance impact...the terminal will need to report to both the kernel (so the TTY can know the new size), as well as write the escape sequence to the client - but this should be very minimal overall, and only impacts clients which have enabled the mode.
Other implementations / considerations:
- Ghostty has implemented
- Kitty has implemented
- Wezterm feature request
- Foot pr
- I have integrated this into two TUI libraries I maintain for go and zig