Add command (effect, program, documentation) to get the current terminal size.
It looks like the size can be obtained with the command CSI18t, but it's not clear this is widely supported. If it's not widely supported, the next step is to use the ioctl C API.
See https://invisible-island.net/xterm/ctlseqs/ctlseqs.html and search for XTWINOPS for the escape code to get the terminal size (we're interested in getting it in characters; pixels doesn't seem as useful).
For example of C code using ioctl see https://rosettacode.org/wiki/Terminal_control/Dimensions#Library:_BSD_libc
Crossterm code, which is a bit more complicated, is at https://github.com/crossterm-rs/crossterm/blob/e104a7cb400910609cdde36f322e3905c4baa805/src/terminal/sys/unix.rs#L59
Add command (effect, program, documentation) to get the current terminal size.
It looks like the size can be obtained with the command
CSI18t, but it's not clear this is widely supported. If it's not widely supported, the next step is to use theioctlC API.See https://invisible-island.net/xterm/ctlseqs/ctlseqs.html and search for
XTWINOPSfor the escape code to get the terminal size (we're interested in getting it in characters; pixels doesn't seem as useful).For example of C code using
ioctlsee https://rosettacode.org/wiki/Terminal_control/Dimensions#Library:_BSD_libcCrossterm code, which is a bit more complicated, is at https://github.com/crossterm-rs/crossterm/blob/e104a7cb400910609cdde36f322e3905c4baa805/src/terminal/sys/unix.rs#L59