![]() |
libghostty
|
Utilities for encoding terminal size reports into escape sequences, supporting in-band size reports (mode 2048) and XTWINOPS responses (CSI 14 t, CSI 16 t, CSI 18 t).
Use ghostty_size_report_encode() to encode a size report into a caller-provided buffer. If the buffer is too small, the function returns GHOSTTY_OUT_OF_SPACE and sets the required size in the output parameter.
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_STYLE_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE } |
Functions | |
| GHOSTTY_API GhosttyResult | ghostty_size_report_encode (GhosttySizeReportStyle style, GhosttySizeReportSize size, char *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, |
| GhosttySizeReportSize | size, | ||
| char * | 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 the buffer is too small, the function returns GHOSTTY_OUT_OF_SPACE and writes the required buffer size to out_written. The caller can then retry with a sufficiently sized buffer.
| Style | The size report format to encode | |
| size | Terminal size information | |
| buf | Output buffer to write the encoded sequence into (may be NULL) | |
| buf_len | Size of the output buffer in bytes | |
| [out] | out_written | On success, the number of bytes written. On GHOSTTY_OUT_OF_SPACE, the required buffer size. |