mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-10-01 15:38:35 +00:00
example/c-vt: parse a full OSC command
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <ghostty/vt.h>
|
#include <ghostty/vt.h>
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
@@ -6,6 +7,19 @@ int main() {
|
|||||||
if (ghostty_osc_new(NULL, &parser) != GHOSTTY_SUCCESS) {
|
if (ghostty_osc_new(NULL, &parser) != GHOSTTY_SUCCESS) {
|
||||||
return 1;
|
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);
|
ghostty_osc_free(parser);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user