diff options
Diffstat (limited to 'example/c-vt/src/main.c')
| -rw-r--r-- | example/c-vt/src/main.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/example/c-vt/src/main.c b/example/c-vt/src/main.c index 00ea3618f..b1297d7a7 100644 --- a/example/c-vt/src/main.c +++ b/example/c-vt/src/main.c @@ -1,5 +1,6 @@ #include <stddef.h> #include <stdio.h> +#include <string.h> #include <ghostty/vt.h> int main() { @@ -8,10 +9,13 @@ int main() { return 1; } - // Setup change window title command to change the title to "a" + // Setup change window title command to change the title to "hello" ghostty_osc_next(parser, '0'); ghostty_osc_next(parser, ';'); - ghostty_osc_next(parser, 'a'); + const char *title = "hello"; + for (size_t i = 0; i < strlen(title); i++) { + ghostty_osc_next(parser, title[i]); + } // End parsing and get command GhosttyOscCommand command = ghostty_osc_end(parser, 0); @@ -20,6 +24,13 @@ int main() { GhosttyOscCommandType type = ghostty_osc_command_type(command); printf("Command type: %d\n", type); + // Extract and print the title + if (ghostty_osc_command_data(command, GHOSTTY_OSC_DATA_CHANGE_WINDOW_TITLE_STR, &title)) { + printf("Extracted title: %s\n", title); + } else { + printf("Failed to extract title\n"); + } + ghostty_osc_free(parser); return 0; } |
