![]() |
libghostty-vt 0.0.0
|
Encode size reports, for mode 2048 and XTWINOPS queries. More...
Encode size reports, for mode 2048 and XTWINOPS queries.
A size report tells a program how big your terminal is, in cells and pixels.
These answer in-band size reports (mode 2048) and XTWINOPS queries (CSI 14 t, CSI 16 t, CSI 18 t, CSI 19 t). A terminal answers those for you through a GhosttyTerminalSizeFn, so you only need this without one. Fill in a GhosttySizeReportSize and pass it to ghostty_size_report_encode().
Full program: c-vt-size-report/src/main.c
See the Effects guide for the terminal's callback.
Enumerations | |
| enum | GhosttySizeReportStyle { GHOSTTY_SIZE_REPORT_MODE_2048 = 0 , GHOSTTY_SIZE_REPORT_CSI_14_T = 1 , GHOSTTY_SIZE_REPORT_CSI_16_T = 2 , GHOSTTY_SIZE_REPORT_CSI_18_T = 3 , GHOSTTY_SIZE_REPORT_CSI_19_T = 4 , GHOSTTY_SIZE_REPORT_STYLE_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE } |
Functions | |
| GHOSTTY_API GhosttyResult | ghostty_size_report_encode (GhosttySizeReportStyle style, const GhosttySizeReportSize *size, uint8_t *buf, size_t buf_len, size_t *out_written) |
Data Structures | |
| struct | GhosttySizeReportSize |
Size report style.
Determines the output format for the terminal size report.
Definition at line 43 of file size_report.h.
| GHOSTTY_API GhosttyResult ghostty_size_report_encode | ( | GhosttySizeReportStyle | style, |
| const GhosttySizeReportSize * | size, | ||
| uint8_t * | buf, | ||
| size_t | buf_len, | ||
| size_t * | out_written ) |
Encode a terminal size report into an escape sequence.
Encodes a size report in the format specified by style into the provided buffer.
If buf is too small, this returns GHOSTTY_OUT_OF_SPACE and sets out_written to the size needed. The buffer may then hold part of the sequence, which you should discard. To get the size without encoding anything, pass NULL for buf and 0 for buf_len.
| style | The size report format to encode | |
| size | Terminal size information | |
| buf | Buffer to write the sequence into. May be NULL if buf_len is 0. | |
| buf_len | Size of buf in bytes | |
| [out] | out_written | The number of bytes written, or the size needed if the result is GHOSTTY_OUT_OF_SPACE |
size is NULL