diff options
| author | Mitchell Hashimoto <m@mitchellh.com> | 2025-09-28 07:24:08 -0700 |
|---|---|---|
| committer | Mitchell Hashimoto <m@mitchellh.com> | 2025-09-28 07:24:09 -0700 |
| commit | a76297058fd2da5c8452dcaf356dfcb6343e1574 (patch) | |
| tree | 5dbec92cf203ab83888be0bea1d6f1ac6fae7ab3 /example | |
| parent | cfe9f194542c521c51a3d1ab6f563fe5b318da77 (diff) | |
example/c-vt: parse a full OSC command
Diffstat (limited to 'example')
| -rw-r--r-- | example/c-vt/src/main.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/example/c-vt/src/main.c b/example/c-vt/src/main.c index 1eaa659d2..00ea3618f 100644 --- a/example/c-vt/src/main.c +++ b/example/c-vt/src/main.c @@ -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; } |
