diff options
| author | Mitchell Hashimoto <m@mitchellh.com> | 2025-09-27 15:15:11 -0700 |
|---|---|---|
| committer | Mitchell Hashimoto <m@mitchellh.com> | 2025-09-27 15:15:51 -0700 |
| commit | f564ffa30b8b78ec9f480864edda96e4b63051c7 (patch) | |
| tree | 1e17ffa41cf68d8d2d850f367995be9da48325c3 /include/ghostty | |
| parent | cc0f2e79cd75add2cb2b82a0372c92fc4fb4b4c5 (diff) | |
lib-vt: expose ghostty_osc_end
Diffstat (limited to 'include/ghostty')
| -rw-r--r-- | include/ghostty/vt.h | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/include/ghostty/vt.h b/include/ghostty/vt.h index c784dcb0e..fc5eb1812 100644 --- a/include/ghostty/vt.h +++ b/include/ghostty/vt.h @@ -289,9 +289,37 @@ void ghostty_osc_reset(GhosttyOscParser parser); */ void ghostty_osc_next(GhosttyOscParser parser, uint8_t byte); -GhosttyOscCommand ghostty_osc_end(GhosttyOscParser parser); -GhosttyOscCommandType ghostty_osc_command_type(GhosttyOscCommand command); -bool ghostty_osc_command_data(GhosttyOscCommand command, GhosttyOscCommandData, void *result); +/** + * Finalize OSC parsing and retrieve the parsed command. + * + * Call this function after feeding all bytes of an OSC sequence to the parser + * using ghostty_osc_next() with the exception of the terminating character + * (ESC or ST). This function finalizes the parsing process and returns the + * parsed OSC command. + * + * The return value is never NULL. Invalid commands will return a command + * with type GHOSTTY_OSC_COMMAND_INVALID. + * + * The terminator parameter specifies the byte that terminated the OSC sequence + * (typically 0x07 for BEL or 0x5C for ST after ESC). This information is + * preserved in the parsed command so that responses can use the same terminator + * format for better compatibility with the calling program. For commands that + * do not require a response, this parameter is ignored and the resulting + * command will not retain the terminator information. + * + * The returned command handle is valid until the next call to any + * `ghostty_osc_*` function with the same parser instance with the exception + * of command introspection functions such as `ghostty_osc_command_type`. + * + * @param parser The parser handle, must not be null. + * @param terminator The terminating byte of the OSC sequence (0x07 for BEL, 0x5C for ST) + * @return Handle to the parsed OSC command + */ +GhosttyOscCommand ghostty_osc_end(GhosttyOscParser parser, uint8_t terminator); + +// TODO +// GhosttyOscCommandType ghostty_osc_command_type(GhosttyOscCommand command); +// bool ghostty_osc_command_data(GhosttyOscCommand command, GhosttyOscCommandData, void *result); #ifdef __cplusplus } |
