example/c-vt: parse a full OSC command

pull/8941/head
Mitchell Hashimoto 2025-09-28 07:24:08 -07:00
parent cfe9f19454
commit a76297058f
No known key found for this signature in database
GPG Key ID: 523D5DC389D273BC
1 changed files with 14 additions and 0 deletions

View File

@ -1,4 +1,5 @@
#include <stddef.h>
#include <stdio.h>
#include <ghostty/vt.h>
int main() {
@ -6,6 +7,19 @@ int main() {
if (ghostty_osc_new(NULL, &parser) != GHOSTTY_SUCCESS) {
return 1;
}
// Setup change window title command to change the title to "a"
ghostty_osc_next(parser, '0');
ghostty_osc_next(parser, ';');
ghostty_osc_next(parser, 'a');
// End parsing and get command
GhosttyOscCommand command = ghostty_osc_end(parser, 0);
// Get and print command type
GhosttyOscCommandType type = ghostty_osc_command_type(command);
printf("Command type: %d\n", type);
ghostty_osc_free(parser);
return 0;
}