![]() |
libghostty-vt 0.0.0
|
Encode focus gained and lost events, for mode 1004. More...
Encode focus gained and lost events, for mode 1004.
Encode focus gained and lost events into terminal escape sequences (CSI I / CSI O) for focus reporting mode (mode 1004).
Only send these to a program that turned that mode on. There's no encoder to create, and you don't need a terminal to encode one.
Full program: c-vt-encode-focus/src/main.c
See the Input guide.
Enumerations | |
| enum | GhosttyFocusEvent { GHOSTTY_FOCUS_GAINED = 0 , GHOSTTY_FOCUS_LOST = 1 , GHOSTTY_FOCUS_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE } |
Functions | |
| GHOSTTY_API GhosttyResult | ghostty_focus_encode (GhosttyFocusEvent event, uint8_t *buf, size_t buf_len, size_t *out_written) |
| enum GhosttyFocusEvent |
| GHOSTTY_API GhosttyResult ghostty_focus_encode | ( | GhosttyFocusEvent | event, |
| uint8_t * | 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 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.
| event | The focus event to encode | |
| 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 |