![]() |
libghostty
|
Utilities for encoding focus gained/lost events into terminal escape sequences (CSI I / CSI O) for focus reporting mode (mode 1004).
Use ghostty_focus_encode() to encode a focus event 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 | GhosttyFocusEvent { GHOSTTY_FOCUS_GAINED = 0 , GHOSTTY_FOCUS_LOST = 1 } |
Functions | |
| GhosttyResult | ghostty_focus_encode (GhosttyFocusEvent event, char *buf, size_t buf_len, size_t *out_written) |
| enum GhosttyFocusEvent |
| GhosttyResult ghostty_focus_encode | ( | GhosttyFocusEvent | event, |
| char * | buf, | ||
| size_t | buf_len, | ||
| size_t * | out_written ) |
Encode a focus event into a terminal escape sequence.
Encodes a focus gained (CSI I) or focus lost (CSI O) report 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.
| event | The focus event to encode | |
| 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. |