| author | |
| committer | |
| log | f9d1c65d475807f70d29deff71b16a922a61c4c0 |
| tree | aab1d41d147defd4a1d2e7ef09c7024c1b8177de |
| parent | 0681d854994ec0ceed0562ae74549ccf8ef2ec41 |
| signature | Signed by PGP key B5690EEEBB952194 |
31 files changed, 206 insertions(+), 4130 deletions(-)
apps/mobile/modules/t3-terminal/README.md+9-6| ... | ... | @@ -8,9 +8,9 @@ The JavaScript contract is intentionally small: |
| 8 | 8 | - resize from the native surface is emitted as `{ cols: number, rows: number }` |
| 9 | 9 | - remote PTY output is delivered by the existing `WsRpcClient.terminal` RPC stream |
| 10 | 10 | |
| 11 | The iOS implementation uses the vendored `GhosttyKit.xcframework` built from the Ghostty custom-I/O | |
| 12 | fork, with T3's iOS 16 compatibility patch applied. `T3TerminalView` owns a `libghostty` surface and | |
| 13 | uses that callback I/O model: | |
| 11 | The iOS implementation uses the vendored `GhosttyKit.xcframework` built from VVTerm's Ghostty | |
| 12 | custom-I/O and live-padding branch. `T3TerminalView` owns a `libghostty` surface and uses that | |
| 13 | callback I/O model: | |
| 14 | 14 | |
| 15 | 15 | 1. initialize libghostty once for the process |
| 16 | 16 | 2. create one Ghostty app and surface per native view |
| ... | ... | @@ -26,14 +26,17 @@ Vendored Ghostty revision and license details are in `THIRD_PARTY_NOTICES.md`. |
| 26 | 26 | |
| 27 | 27 | ## Rebuilding GhosttyKit |
| 28 | 28 | |
| 29 | The checked-in `GhosttyKit.xcframework` is built from the Ghostty custom-I/O fork (https://github.com/Yash-Singh1/ghostty/tree/custom-io). | |
| 30 | Set the directory to the cloned repository checked out on the `custom-io` branch to `GHOSTTY_SOURCE_DIR`. | |
| 29 | The checked-in `GhosttyKit.xcframework` is built from Yash Singh's Ghostty fork at revision | |
| 30 | `cf8edc23f3a6a87a96e41a90013e89e987d34980`. Set `GHOSTTY_SOURCE_DIR` to a clone of | |
| 31 | https://github.com/Yash-Singh1/ghostty checked out at that revision (the | |
| 32 | `t3code/custom-io-ordered-feed` branch when vendored, based on VVTerm's | |
| 33 | `vvterm/custom-io-padding` branch). | |
| 31 | 34 | |
| 32 | 35 | ```bash |
| 33 | 36 | apps/mobile/modules/t3-terminal/scripts/build-libghostty-ios16.sh |
| 34 | 37 | ``` |
| 35 | 38 | |
| 36 | The script builds Ghostty with Zig 0.15.2, strips the iOS archives, and replaces only the | |
| 39 | The script builds Ghostty with Zig 0.16.0, strips the iOS archives, and replaces only the | |
| 37 | 40 | `ios-arm64` and `ios-arm64-simulator` slices. Xcode's Metal toolchain must be installed; if `metal` |
| 38 | 41 | fails, run `xcodebuild -downloadComponent MetalToolchain`. |
| 39 | 42 |
apps/mobile/modules/t3-terminal/THIRD_PARTY_NOTICES.md+5-5| ... | ... | @@ -2,13 +2,13 @@ |
| 2 | 2 | |
| 3 | 3 | ## Ghostty / libghostty |
| 4 | 4 | |
| 5 | The iOS terminal renderer vendors `GhosttyKit.xcframework`, a libghostty build produced from T3's | |
| 6 | iOS 16 support fork. That fork was created from VVTerm's custom-I/O Ghostty fork. | |
| 5 | The iOS terminal renderer vendors `GhosttyKit.xcframework`, a libghostty build produced from | |
| 6 | VVTerm's custom-I/O and live-padding Ghostty branch. | |
| 7 | 7 | |
| 8 | 8 | - Upstream project: https://github.com/ghostty-org/ghostty |
| 9 | - Custom-I/O base fork: https://github.com/wiedymi/ghostty/tree/custom-io | |
| 10 | - Vendored source fork: https://github.com/Yash-Singh1/ghostty/tree/custom-io | |
| 11 | - Vendored revision: `d36c3b8dffd0d756dd5e5f4933962f774a0e6753` | |
| 9 | - Vendored source branch: https://github.com/Yash-Singh1/ghostty/tree/t3code/custom-io-ordered-feed | |
| 10 | - Vendored revision: `cf8edc23f3a6a87a96e41a90013e89e987d34980` | |
| 11 | - Based on: https://github.com/wiedymi/ghostty/tree/vvterm/custom-io-padding | |
| 12 | 12 | - Reference integration: https://github.com/vivy-company/vvterm |
| 13 | 13 | - License: MIT |
| 14 | 14 |
apps/mobile/modules/t3-terminal/Vendor/libghostty/GhosttyKit.xcframework/ios-arm64-simulator/Headers/ghostty.h+92-20| ... | ... | @@ -1,10 +1,14 @@ |
| 1 | // Ghostty embedding API. The documentation for the embedding API is | |
| 2 | // only within the Zig source files that define the implementations. This | |
| 3 | // isn't meant to be a general purpose embedding API (yet) so there hasn't | |
| 4 | // been documentation or example work beyond that. | |
| 1 | // Ghostty's internal embedder API, a.k.a. "libghostty-internal". | |
| 5 | 2 | // |
| 6 | // The only consumer of this API is the macOS app, but the API is built to | |
| 7 | // be more general purpose. | |
| 3 | // The only consumer of this API is the macOS app, and while it is fairly | |
| 4 | // comprehensive, it is tailored to the needs of the macOS app and not designed | |
| 5 | // for external use, hence why most functions are undocumented and some are | |
| 6 | // macOS-specific (e.g. ones dealing with the Metal graphics API). | |
| 7 | // | |
| 8 | // External embedders should instead use `libghostty-vt` or other related | |
| 9 | // packages, which are extensively documented and designed from the ground up | |
| 10 | // to be used in other software. Header files for which can be found in | |
| 11 | // `include/ghostty/`. | |
| 8 | 12 | #ifndef GHOSTTY_H |
| 9 | 13 | #define GHOSTTY_H |
| 10 | 14 | |
| ... | ... | @@ -68,7 +72,7 @@ typedef enum { |
| 68 | 72 | GHOSTTY_PLATFORM_IOS, |
| 69 | 73 | } ghostty_platform_e; |
| 70 | 74 | |
| 71 | // Callback for custom I/O write handler. | |
| 75 | // Callback for custom surface I/O writes. | |
| 72 | 76 | typedef void (*ghostty_surface_write_fn)(void* userdata, |
| 73 | 77 | const uint8_t* data, |
| 74 | 78 | size_t len); |
| ... | ... | @@ -76,19 +80,56 @@ typedef void (*ghostty_surface_write_fn)(void* userdata, |
| 76 | 80 | typedef enum { |
| 77 | 81 | GHOSTTY_CLIPBOARD_STANDARD, |
| 78 | 82 | GHOSTTY_CLIPBOARD_SELECTION, |
| 83 | GHOSTTY_CLIPBOARD_PRIMARY, | |
| 79 | 84 | } ghostty_clipboard_e; |
| 80 | 85 | |
| 86 | // One representation of clipboard contents. The data is binary-safe with | |
| 87 | // an explicit length; it is not necessarily null-terminated. | |
| 81 | 88 | typedef struct { |
| 82 | 89 | const char *mime; |
| 83 | 90 | const char *data; |
| 91 | size_t len; | |
| 84 | 92 | } ghostty_clipboard_content_s; |
| 85 | 93 | |
| 94 | // The payload for completing a clipboard read request. See | |
| 95 | // ghostty_surface_complete_clipboard_request. | |
| 96 | typedef struct { | |
| 97 | const ghostty_clipboard_content_s *contents; | |
| 98 | size_t contents_len; | |
| 99 | const char *const *available; | |
| 100 | size_t available_len; | |
| 101 | bool confirmed; | |
| 102 | bool remember; | |
| 103 | } ghostty_clipboard_complete_s; | |
| 104 | ||
| 105 | // The payload of a clipboard read confirmation request: the would-be | |
| 106 | // completion contents plus the information shown in the permission | |
| 107 | // prompt. See ghostty_runtime_confirm_read_clipboard_cb. | |
| 108 | typedef struct { | |
| 109 | const ghostty_clipboard_content_s *contents; | |
| 110 | size_t contents_len; | |
| 111 | const char *const *available; | |
| 112 | size_t available_len; | |
| 113 | const char *name; | |
| 114 | bool can_remember; | |
| 115 | } ghostty_clipboard_confirm_s; | |
| 116 | ||
| 86 | 117 | typedef enum { |
| 87 | 118 | GHOSTTY_CLIPBOARD_REQUEST_PASTE, |
| 88 | 119 | GHOSTTY_CLIPBOARD_REQUEST_OSC_52_READ, |
| 89 | 120 | GHOSTTY_CLIPBOARD_REQUEST_OSC_52_WRITE, |
| 121 | GHOSTTY_CLIPBOARD_REQUEST_KITTY_READ, | |
| 122 | GHOSTTY_CLIPBOARD_REQUEST_KITTY_WRITE, | |
| 123 | GHOSTTY_CLIPBOARD_REQUEST_LIST, | |
| 90 | 124 | } ghostty_clipboard_request_e; |
| 91 | 125 | |
| 126 | // apprt.ClipboardReadResult | |
| 127 | typedef enum { | |
| 128 | GHOSTTY_CLIPBOARD_READ_STARTED, | |
| 129 | GHOSTTY_CLIPBOARD_READ_UNAVAILABLE, | |
| 130 | GHOSTTY_CLIPBOARD_READ_UNSUPPORTED, | |
| 131 | } ghostty_clipboard_read_result_e; | |
| 132 | ||
| 92 | 133 | typedef enum { |
| 93 | 134 | GHOSTTY_MOUSE_RELEASE, |
| 94 | 135 | GHOSTTY_MOUSE_PRESS, |
| ... | ... | @@ -369,7 +410,6 @@ typedef enum { |
| 369 | 410 | } ghostty_input_trigger_tag_e; |
| 370 | 411 | |
| 371 | 412 | typedef union { |
| 372 | ghostty_input_key_e translated; | |
| 373 | 413 | ghostty_input_key_e physical; |
| 374 | 414 | uint32_t unicode; |
| 375 | 415 | // catch_all has no payload |
| ... | ... | @@ -652,6 +692,12 @@ typedef enum { |
| 652 | 692 | GHOSTTY_INSPECTOR_HIDE, |
| 653 | 693 | } ghostty_action_inspector_e; |
| 654 | 694 | |
| 695 | // apprt.action.ExportTerminalIO.C | |
| 696 | typedef struct { | |
| 697 | const char* contents; | |
| 698 | size_t len; | |
| 699 | } ghostty_action_export_terminal_io_s; | |
| 700 | ||
| 655 | 701 | // apprt.action.QuitTimer |
| 656 | 702 | typedef enum { |
| 657 | 703 | GHOSTTY_QUIT_TIMER_START, |
| ... | ... | @@ -679,6 +725,7 @@ typedef struct { |
| 679 | 725 | typedef enum { |
| 680 | 726 | GHOSTTY_PROMPT_TITLE_SURFACE, |
| 681 | 727 | GHOSTTY_PROMPT_TITLE_TAB, |
| 728 | GHOSTTY_PROMPT_TITLE_WINDOW, | |
| 682 | 729 | } ghostty_action_prompt_title_e; |
| 683 | 730 | |
| 684 | 731 | // apprt.action.Pwd.C |
| ... | ... | @@ -686,6 +733,14 @@ typedef struct { |
| 686 | 733 | const char* pwd; |
| 687 | 734 | } ghostty_action_pwd_s; |
| 688 | 735 | |
| 736 | // apprt.action.OpenConfig | |
| 737 | typedef enum { | |
| 738 | // Open the config in the OS default editor. | |
| 739 | GHOSTTY_ACTION_OPEN_CONFIG_OS_OPEN, | |
| 740 | // Open the config in a new window using $EDITOR or $VISUAL | |
| 741 | GHOSTTY_ACTION_OPEN_CONFIG_NEW_WINDOW, | |
| 742 | } ghostty_action_open_config_e; | |
| 743 | ||
| 689 | 744 | // terminal.MouseShape |
| 690 | 745 | typedef enum { |
| 691 | 746 | GHOSTTY_MOUSE_SHAPE_DEFAULT, |
| ... | ... | @@ -819,6 +874,7 @@ typedef enum { |
| 819 | 874 | GHOSTTY_ACTION_OPEN_URL_KIND_UNKNOWN, |
| 820 | 875 | GHOSTTY_ACTION_OPEN_URL_KIND_TEXT, |
| 821 | 876 | GHOSTTY_ACTION_OPEN_URL_KIND_HTML, |
| 877 | GHOSTTY_ACTION_OPEN_URL_KIND_OSC8, | |
| 822 | 878 | } ghostty_action_open_url_kind_e; |
| 823 | 879 | |
| 824 | 880 | // apprt.action.OpenUrl.C |
| ... | ... | @@ -921,9 +977,11 @@ typedef enum { |
| 921 | 977 | GHOSTTY_ACTION_INSPECTOR, |
| 922 | 978 | GHOSTTY_ACTION_SHOW_GTK_INSPECTOR, |
| 923 | 979 | GHOSTTY_ACTION_RENDER_INSPECTOR, |
| 980 | GHOSTTY_ACTION_EXPORT_TERMINAL_IO, | |
| 924 | 981 | GHOSTTY_ACTION_DESKTOP_NOTIFICATION, |
| 925 | 982 | GHOSTTY_ACTION_SET_TITLE, |
| 926 | 983 | GHOSTTY_ACTION_SET_TAB_TITLE, |
| 984 | GHOSTTY_ACTION_SET_WINDOW_TITLE, | |
| 927 | 985 | GHOSTTY_ACTION_PROMPT_TITLE, |
| 928 | 986 | GHOSTTY_ACTION_PWD, |
| 929 | 987 | GHOSTTY_ACTION_MOUSE_SHAPE, |
| ... | ... | @@ -941,6 +999,7 @@ typedef enum { |
| 941 | 999 | GHOSTTY_ACTION_CONFIG_CHANGE, |
| 942 | 1000 | GHOSTTY_ACTION_CLOSE_WINDOW, |
| 943 | 1001 | GHOSTTY_ACTION_RING_BELL, |
| 1002 | GHOSTTY_ACTION_SELECTION_CHANGED, | |
| 944 | 1003 | GHOSTTY_ACTION_UNDO, |
| 945 | 1004 | GHOSTTY_ACTION_REDO, |
| 946 | 1005 | GHOSTTY_ACTION_CHECK_FOR_UPDATES, |
| ... | ... | @@ -955,6 +1014,7 @@ typedef enum { |
| 955 | 1014 | GHOSTTY_ACTION_SEARCH_SELECTED, |
| 956 | 1015 | GHOSTTY_ACTION_READONLY, |
| 957 | 1016 | GHOSTTY_ACTION_COPY_TITLE_TO_CLIPBOARD, |
| 1017 | GHOSTTY_ACTION_MOVE_TAB_TO_NEW_WINDOW, | |
| 958 | 1018 | } ghostty_action_tag_e; |
| 959 | 1019 | |
| 960 | 1020 | typedef union { |
| ... | ... | @@ -970,6 +1030,7 @@ typedef union { |
| 970 | 1030 | ghostty_action_cell_size_s cell_size; |
| 971 | 1031 | ghostty_action_scrollbar_s scrollbar; |
| 972 | 1032 | ghostty_action_inspector_e inspector; |
| 1033 | ghostty_action_export_terminal_io_s export_terminal_io; | |
| 973 | 1034 | ghostty_action_desktop_notification_s desktop_notification; |
| 974 | 1035 | ghostty_action_set_title_s set_title; |
| 975 | 1036 | ghostty_action_set_title_s set_tab_title; |
| ... | ... | @@ -996,6 +1057,7 @@ typedef union { |
| 996 | 1057 | ghostty_action_search_total_s search_total; |
| 997 | 1058 | ghostty_action_search_selected_s search_selected; |
| 998 | 1059 | ghostty_action_readonly_e readonly; |
| 1060 | ghostty_action_open_config_e open_config; | |
| 999 | 1061 | } ghostty_action_u; |
| 1000 | 1062 | |
| 1001 | 1063 | typedef struct { |
| ... | ... | @@ -1004,12 +1066,16 @@ typedef struct { |
| 1004 | 1066 | } ghostty_action_s; |
| 1005 | 1067 | |
| 1006 | 1068 | typedef void (*ghostty_runtime_wakeup_cb)(void*); |
| 1007 | typedef bool (*ghostty_runtime_read_clipboard_cb)(void*, | |
| 1008 | ghostty_clipboard_e, | |
| 1009 | void*); | |
| 1069 | typedef ghostty_clipboard_read_result_e (*ghostty_runtime_read_clipboard_cb)( | |
| 1070 | void*, | |
| 1071 | ghostty_clipboard_e, | |
| 1072 | void*, | |
| 1073 | const char* const*, | |
| 1074 | size_t, | |
| 1075 | bool); | |
| 1010 | 1076 | typedef void (*ghostty_runtime_confirm_read_clipboard_cb)( |
| 1011 | 1077 | void*, |
| 1012 | const char*, | |
| 1078 | const ghostty_clipboard_confirm_s*, | |
| 1013 | 1079 | void*, |
| 1014 | 1080 | ghostty_clipboard_request_e); |
| 1015 | 1081 | typedef void (*ghostty_runtime_write_clipboard_cb)(void*, |
| ... | ... | @@ -1061,6 +1127,8 @@ typedef union { |
| 1061 | 1127 | // apprt.ipc.Action.Key |
| 1062 | 1128 | typedef enum { |
| 1063 | 1129 | GHOSTTY_IPC_ACTION_NEW_WINDOW, |
| 1130 | GHOSTTY_IPC_ACTION_NEW_TAB, | |
| 1131 | GHOSTTY_IPC_ACTION_TOGGLE_QUICK_TERMINAL, | |
| 1064 | 1132 | } ghostty_ipc_action_tag_e; |
| 1065 | 1133 | |
| 1066 | 1134 | //------------------------------------------------------------------- |
| ... | ... | @@ -1084,6 +1152,7 @@ GHOSTTY_API bool ghostty_config_get(ghostty_config_t, void*, const char*, uintpt |
| 1084 | 1152 | GHOSTTY_API ghostty_input_trigger_s ghostty_config_trigger(ghostty_config_t, |
| 1085 | 1153 | const char*, |
| 1086 | 1154 | uintptr_t); |
| 1155 | GHOSTTY_API bool ghostty_config_key_is_binding(ghostty_config_t, ghostty_input_key_s); | |
| 1087 | 1156 | GHOSTTY_API uint32_t ghostty_config_diagnostics_count(ghostty_config_t); |
| 1088 | 1157 | GHOSTTY_API ghostty_diagnostic_s ghostty_config_get_diagnostic(ghostty_config_t, uint32_t); |
| 1089 | 1158 | GHOSTTY_API ghostty_string_s ghostty_config_open_path(void); |
| ... | ... | @@ -1095,7 +1164,6 @@ GHOSTTY_API void ghostty_app_tick(ghostty_app_t); |
| 1095 | 1164 | GHOSTTY_API void* ghostty_app_userdata(ghostty_app_t); |
| 1096 | 1165 | GHOSTTY_API void ghostty_app_set_focus(ghostty_app_t, bool); |
| 1097 | 1166 | GHOSTTY_API bool ghostty_app_key(ghostty_app_t, ghostty_input_key_s); |
| 1098 | GHOSTTY_API bool ghostty_app_key_is_binding(ghostty_app_t, ghostty_input_key_s); | |
| 1099 | 1167 | GHOSTTY_API void ghostty_app_keyboard_changed(ghostty_app_t); |
| 1100 | 1168 | GHOSTTY_API void ghostty_app_open_config(ghostty_app_t); |
| 1101 | 1169 | GHOSTTY_API void ghostty_app_update_config(ghostty_app_t, ghostty_config_t); |
| ... | ... | @@ -1116,10 +1184,12 @@ GHOSTTY_API bool ghostty_surface_needs_confirm_quit(ghostty_surface_t); |
| 1116 | 1184 | GHOSTTY_API bool ghostty_surface_process_exited(ghostty_surface_t); |
| 1117 | 1185 | GHOSTTY_API void ghostty_surface_refresh(ghostty_surface_t); |
| 1118 | 1186 | GHOSTTY_API void ghostty_surface_draw(ghostty_surface_t); |
| 1119 | GHOSTTY_API void ghostty_surface_feed_data(ghostty_surface_t, const uint8_t*, size_t); | |
| 1187 | GHOSTTY_API void ghostty_surface_feed_data(ghostty_surface_t, | |
| 1188 | const uint8_t*, | |
| 1189 | size_t); | |
| 1120 | 1190 | GHOSTTY_API void ghostty_surface_set_write_callback(ghostty_surface_t, |
| 1121 | ghostty_surface_write_fn, | |
| 1122 | void*); | |
| 1191 | ghostty_surface_write_fn, | |
| 1192 | void*); | |
| 1123 | 1193 | GHOSTTY_API void ghostty_surface_set_content_scale(ghostty_surface_t, double, double); |
| 1124 | 1194 | GHOSTTY_API void ghostty_surface_set_focus(ghostty_surface_t, bool); |
| 1125 | 1195 | GHOSTTY_API void ghostty_surface_set_occlusion(ghostty_surface_t, bool); |
| ... | ... | @@ -1161,10 +1231,12 @@ GHOSTTY_API void ghostty_surface_split_resize(ghostty_surface_t, |
| 1161 | 1231 | uint16_t); |
| 1162 | 1232 | GHOSTTY_API void ghostty_surface_split_equalize(ghostty_surface_t); |
| 1163 | 1233 | GHOSTTY_API bool ghostty_surface_binding_action(ghostty_surface_t, const char*, uintptr_t); |
| 1164 | GHOSTTY_API void ghostty_surface_complete_clipboard_request(ghostty_surface_t, | |
| 1165 | const char*, | |
| 1166 | void*, | |
| 1167 | bool); | |
| 1234 | GHOSTTY_API void ghostty_surface_complete_clipboard_request( | |
| 1235 | ghostty_surface_t, | |
| 1236 | const ghostty_clipboard_complete_s*, | |
| 1237 | void*); | |
| 1238 | GHOSTTY_API void ghostty_surface_deny_clipboard_request(ghostty_surface_t, | |
| 1239 | void*); | |
| 1168 | 1240 | GHOSTTY_API bool ghostty_surface_has_selection(ghostty_surface_t); |
| 1169 | 1241 | GHOSTTY_API bool ghostty_surface_read_selection(ghostty_surface_t, ghostty_text_s*); |
| 1170 | 1242 | GHOSTTY_API bool ghostty_surface_read_text(ghostty_surface_t, |
apps/mobile/modules/t3-terminal/Vendor/libghostty/GhosttyKit.xcframework/ios-arm64-simulator/Headers/ghostty/vt.h deleted-87| ... | ... | @@ -1,87 +0,0 @@ |
| 1 | /** | |
| 2 | * @file vt.h | |
| 3 | * | |
| 4 | * libghostty-vt - Virtual terminal emulator library | |
| 5 | * | |
| 6 | * This library provides functionality for parsing and handling terminal | |
| 7 | * escape sequences as well as maintaining terminal state such as styles, | |
| 8 | * cursor position, screen, scrollback, and more. | |
| 9 | * | |
| 10 | * WARNING: This is an incomplete, work-in-progress API. It is not yet | |
| 11 | * stable and is definitely going to change. | |
| 12 | */ | |
| 13 | ||
| 14 | /** | |
| 15 | * @mainpage libghostty-vt - Virtual Terminal Emulator Library | |
| 16 | * | |
| 17 | * libghostty-vt is a C library which implements a modern terminal emulator, | |
| 18 | * extracted from the [Ghostty](https://ghostty.org) terminal emulator. | |
| 19 | * | |
| 20 | * libghostty-vt contains the logic for handling the core parts of a terminal | |
| 21 | * emulator: parsing terminal escape sequences, maintaining terminal state, | |
| 22 | * encoding input events, etc. It can handle scrollback, line wrapping, | |
| 23 | * reflow on resize, and more. | |
| 24 | * | |
| 25 | * @warning This library is currently in development and the API is not yet stable. | |
| 26 | * Breaking changes are expected in future versions. Use with caution in production code. | |
| 27 | * | |
| 28 | * @section groups_sec API Reference | |
| 29 | * | |
| 30 | * The API is organized into the following groups: | |
| 31 | * - @ref key "Key Encoding" - Encode key events into terminal sequences | |
| 32 | * - @ref osc "OSC Parser" - Parse OSC (Operating System Command) sequences | |
| 33 | * - @ref sgr "SGR Parser" - Parse SGR (Select Graphic Rendition) sequences | |
| 34 | * - @ref paste "Paste Utilities" - Validate paste data safety | |
| 35 | * - @ref allocator "Memory Management" - Memory management and custom allocators | |
| 36 | * - @ref wasm "WebAssembly Utilities" - WebAssembly convenience functions | |
| 37 | * | |
| 38 | * @section examples_sec Examples | |
| 39 | * | |
| 40 | * Complete working examples: | |
| 41 | * - @ref c-vt/src/main.c - OSC parser example | |
| 42 | * - @ref c-vt-key-encode/src/main.c - Key encoding example | |
| 43 | * - @ref c-vt-paste/src/main.c - Paste safety check example | |
| 44 | * - @ref c-vt-sgr/src/main.c - SGR parser example | |
| 45 | * | |
| 46 | */ | |
| 47 | ||
| 48 | /** @example c-vt/src/main.c | |
| 49 | * This example demonstrates how to use the OSC parser to parse an OSC sequence, | |
| 50 | * extract command information, and retrieve command-specific data like window titles. | |
| 51 | */ | |
| 52 | ||
| 53 | /** @example c-vt-key-encode/src/main.c | |
| 54 | * This example demonstrates how to use the key encoder to convert key events | |
| 55 | * into terminal escape sequences using the Kitty keyboard protocol. | |
| 56 | */ | |
| 57 | ||
| 58 | /** @example c-vt-paste/src/main.c | |
| 59 | * This example demonstrates how to use the paste utilities to check if | |
| 60 | * paste data is safe before sending it to the terminal. | |
| 61 | */ | |
| 62 | ||
| 63 | /** @example c-vt-sgr/src/main.c | |
| 64 | * This example demonstrates how to use the SGR parser to parse terminal | |
| 65 | * styling sequences and extract text attributes like colors and underline styles. | |
| 66 | */ | |
| 67 | ||
| 68 | #ifndef GHOSTTY_VT_H | |
| 69 | #define GHOSTTY_VT_H | |
| 70 | ||
| 71 | #ifdef __cplusplus | |
| 72 | extern "C" { | |
| 73 | #endif | |
| 74 | ||
| 75 | #include <ghostty/vt/result.h> | |
| 76 | #include <ghostty/vt/allocator.h> | |
| 77 | #include <ghostty/vt/osc.h> | |
| 78 | #include <ghostty/vt/sgr.h> | |
| 79 | #include <ghostty/vt/key.h> | |
| 80 | #include <ghostty/vt/paste.h> | |
| 81 | #include <ghostty/vt/wasm.h> | |
| 82 | ||
| 83 | #ifdef __cplusplus | |
| 84 | } | |
| 85 | #endif | |
| 86 | ||
| 87 | #endif /* GHOSTTY_VT_H */ |
apps/mobile/modules/t3-terminal/Vendor/libghostty/GhosttyKit.xcframework/ios-arm64-simulator/Headers/ghostty/vt/allocator.h deleted-196| ... | ... | @@ -1,196 +0,0 @@ |
| 1 | /** | |
| 2 | * @file allocator.h | |
| 3 | * | |
| 4 | * Memory management interface for libghostty-vt. | |
| 5 | */ | |
| 6 | ||
| 7 | #ifndef GHOSTTY_VT_ALLOCATOR_H | |
| 8 | #define GHOSTTY_VT_ALLOCATOR_H | |
| 9 | ||
| 10 | #include <stdbool.h> | |
| 11 | #include <stddef.h> | |
| 12 | #include <stdint.h> | |
| 13 | ||
| 14 | /** @defgroup allocator Memory Management | |
| 15 | * | |
| 16 | * libghostty-vt does require memory allocation for various operations, | |
| 17 | * but is resilient to allocation failures and will gracefully handle | |
| 18 | * out-of-memory situations by returning error codes. | |
| 19 | * | |
| 20 | * The exact memory management semantics are documented in the relevant | |
| 21 | * functions and data structures. | |
| 22 | * | |
| 23 | * libghostty-vt uses explicit memory allocation via an allocator | |
| 24 | * interface provided by GhosttyAllocator. The interface is based on the | |
| 25 | * [Zig](https://ziglang.org) allocator interface, since this has been | |
| 26 | * shown to be a flexible and powerful interface in practice and enables | |
| 27 | * a wide variety of allocation strategies. | |
| 28 | * | |
| 29 | * **For the common case, you can pass NULL as the allocator for any | |
| 30 | * function that accepts one,** and libghostty will use a default allocator. | |
| 31 | * The default allocator will be libc malloc/free if libc is linked. | |
| 32 | * Otherwise, a custom allocator is used (currently Zig's SMP allocator) | |
| 33 | * that doesn't require any external dependencies. | |
| 34 | * | |
| 35 | * ## Basic Usage | |
| 36 | * | |
| 37 | * For simple use cases, you can ignore this interface entirely by passing NULL | |
| 38 | * as the allocator parameter to functions that accept one. This will use the | |
| 39 | * default allocator (typically libc malloc/free, if libc is linked, but | |
| 40 | * we provide our own default allocator if libc isn't linked). | |
| 41 | * | |
| 42 | * To use a custom allocator: | |
| 43 | * 1. Implement the GhosttyAllocatorVtable function pointers | |
| 44 | * 2. Create a GhosttyAllocator struct with your vtable and context | |
| 45 | * 3. Pass the allocator to functions that accept one | |
| 46 | * | |
| 47 | * @{ | |
| 48 | */ | |
| 49 | ||
| 50 | /** | |
| 51 | * Function table for custom memory allocator operations. | |
| 52 | * | |
| 53 | * This vtable defines the interface for a custom memory allocator. All | |
| 54 | * function pointers must be valid and non-NULL. | |
| 55 | * | |
| 56 | * @ingroup allocator | |
| 57 | * | |
| 58 | * If you're not going to use a custom allocator, you can ignore all of | |
| 59 | * this. All functions that take an allocator pointer allow NULL to use a | |
| 60 | * default allocator. | |
| 61 | * | |
| 62 | * The interface is based on the Zig allocator interface. I'll say up front | |
| 63 | * that it is easy to look at this interface and think "wow, this is really | |
| 64 | * overcomplicated". The reason for this complexity is well thought out by | |
| 65 | * the Zig folks, and it enables a diverse set of allocation strategies | |
| 66 | * as shown by the Zig ecosystem. As a consolation, please note that many | |
| 67 | * of the arguments are only needed for advanced use cases and can be | |
| 68 | * safely ignored in simple implementations. For example, if you look at | |
| 69 | * the Zig implementation of the libc allocator in `lib/std/heap.zig` | |
| 70 | * (search for CAllocator), you'll see it is very simple. | |
| 71 | * | |
| 72 | * We chose to align with the Zig allocator interface because: | |
| 73 | * | |
| 74 | * 1. It is a proven interface that serves a wide variety of use cases | |
| 75 | * in the real world via the Zig ecosystem. It's shown to work. | |
| 76 | * | |
| 77 | * 2. Our core implementation itself is Zig, and this lets us very | |
| 78 | * cheaply and easily convert between C and Zig allocators. | |
| 79 | * | |
| 80 | * NOTE(mitchellh): In the future, we can have default implementations of | |
| 81 | * resize/remap and allow those to be null. | |
| 82 | */ | |
| 83 | typedef struct { | |
| 84 | /** | |
| 85 | * Return a pointer to `len` bytes with specified `alignment`, or return | |
| 86 | * `NULL` indicating the allocation failed. | |
| 87 | * | |
| 88 | * @param ctx The allocator context | |
| 89 | * @param len Number of bytes to allocate | |
| 90 | * @param alignment Required alignment for the allocation. Guaranteed to | |
| 91 | * be a power of two between 1 and 16 inclusive. | |
| 92 | * @param ret_addr First return address of the allocation call stack (0 if not provided) | |
| 93 | * @return Pointer to allocated memory, or NULL if allocation failed | |
| 94 | */ | |
| 95 | void* (*alloc)(void *ctx, size_t len, uint8_t alignment, uintptr_t ret_addr); | |
| 96 | ||
| 97 | /** | |
| 98 | * Attempt to expand or shrink memory in place. | |
| 99 | * | |
| 100 | * `memory_len` must equal the length requested from the most recent | |
| 101 | * successful call to `alloc`, `resize`, or `remap`. `alignment` must | |
| 102 | * equal the same value that was passed as the `alignment` parameter to | |
| 103 | * the original `alloc` call. | |
| 104 | * | |
| 105 | * `new_len` must be greater than zero. | |
| 106 | * | |
| 107 | * @param ctx The allocator context | |
| 108 | * @param memory Pointer to the memory block to resize | |
| 109 | * @param memory_len Current size of the memory block | |
| 110 | * @param alignment Alignment (must match original allocation) | |
| 111 | * @param new_len New requested size | |
| 112 | * @param ret_addr First return address of the allocation call stack (0 if not provided) | |
| 113 | * @return true if resize was successful in-place, false if relocation would be required | |
| 114 | */ | |
| 115 | bool (*resize)(void *ctx, void *memory, size_t memory_len, uint8_t alignment, size_t new_len, uintptr_t ret_addr); | |
| 116 | ||
| 117 | /** | |
| 118 | * Attempt to expand or shrink memory, allowing relocation. | |
| 119 | * | |
| 120 | * `memory_len` must equal the length requested from the most recent | |
| 121 | * successful call to `alloc`, `resize`, or `remap`. `alignment` must | |
| 122 | * equal the same value that was passed as the `alignment` parameter to | |
| 123 | * the original `alloc` call. | |
| 124 | * | |
| 125 | * A non-`NULL` return value indicates the resize was successful. The | |
| 126 | * allocation may have same address, or may have been relocated. In either | |
| 127 | * case, the allocation now has size of `new_len`. A `NULL` return value | |
| 128 | * indicates that the resize would be equivalent to allocating new memory, | |
| 129 | * copying the bytes from the old memory, and then freeing the old memory. | |
| 130 | * In such case, it is more efficient for the caller to perform the copy. | |
| 131 | * | |
| 132 | * `new_len` must be greater than zero. | |
| 133 | * | |
| 134 | * @param ctx The allocator context | |
| 135 | * @param memory Pointer to the memory block to remap | |
| 136 | * @param memory_len Current size of the memory block | |
| 137 | * @param alignment Alignment (must match original allocation) | |
| 138 | * @param new_len New requested size | |
| 139 | * @param ret_addr First return address of the allocation call stack (0 if not provided) | |
| 140 | * @return Pointer to resized memory (may be relocated), or NULL if manual copy is needed | |
| 141 | */ | |
| 142 | void* (*remap)(void *ctx, void *memory, size_t memory_len, uint8_t alignment, size_t new_len, uintptr_t ret_addr); | |
| 143 | ||
| 144 | /** | |
| 145 | * Free and invalidate a region of memory. | |
| 146 | * | |
| 147 | * `memory_len` must equal the length requested from the most recent | |
| 148 | * successful call to `alloc`, `resize`, or `remap`. `alignment` must | |
| 149 | * equal the same value that was passed as the `alignment` parameter to | |
| 150 | * the original `alloc` call. | |
| 151 | * | |
| 152 | * @param ctx The allocator context | |
| 153 | * @param memory Pointer to the memory block to free | |
| 154 | * @param memory_len Size of the memory block | |
| 155 | * @param alignment Alignment (must match original allocation) | |
| 156 | * @param ret_addr First return address of the allocation call stack (0 if not provided) | |
| 157 | */ | |
| 158 | void (*free)(void *ctx, void *memory, size_t memory_len, uint8_t alignment, uintptr_t ret_addr); | |
| 159 | } GhosttyAllocatorVtable; | |
| 160 | ||
| 161 | /** | |
| 162 | * Custom memory allocator. | |
| 163 | * | |
| 164 | * For functions that take an allocator pointer, a NULL pointer indicates | |
| 165 | * that the default allocator should be used. The default allocator will | |
| 166 | * be libc malloc/free if we're linking to libc. If libc isn't linked, | |
| 167 | * a custom allocator is used (currently Zig's SMP allocator). | |
| 168 | * | |
| 169 | * @ingroup allocator | |
| 170 | * | |
| 171 | * Usage example: | |
| 172 | * @code | |
| 173 | * GhosttyAllocator allocator = { | |
| 174 | * .vtable = &my_allocator_vtable, | |
| 175 | * .ctx = my_allocator_state | |
| 176 | * }; | |
| 177 | * @endcode | |
| 178 | */ | |
| 179 | typedef struct GhosttyAllocator { | |
| 180 | /** | |
| 181 | * Opaque context pointer passed to all vtable functions. | |
| 182 | * This allows the allocator implementation to maintain state | |
| 183 | * or reference external resources needed for memory management. | |
| 184 | */ | |
| 185 | void *ctx; | |
| 186 | ||
| 187 | /** | |
| 188 | * Pointer to the allocator's vtable containing function pointers | |
| 189 | * for memory operations (alloc, resize, remap, free). | |
| 190 | */ | |
| 191 | const GhosttyAllocatorVtable *vtable; | |
| 192 | } GhosttyAllocator; | |
| 193 | ||
| 194 | /** @} */ | |
| 195 | ||
| 196 | #endif /* GHOSTTY_VT_ALLOCATOR_H */ |
apps/mobile/modules/t3-terminal/Vendor/libghostty/GhosttyKit.xcframework/ios-arm64-simulator/Headers/ghostty/vt/color.h deleted-96| ... | ... | @@ -1,96 +0,0 @@ |
| 1 | /** | |
| 2 | * @file color.h | |
| 3 | * | |
| 4 | * Color types and utilities. | |
| 5 | */ | |
| 6 | ||
| 7 | #ifndef GHOSTTY_VT_COLOR_H | |
| 8 | #define GHOSTTY_VT_COLOR_H | |
| 9 | ||
| 10 | #include <stdint.h> | |
| 11 | ||
| 12 | #ifdef __cplusplus | |
| 13 | extern "C" { | |
| 14 | #endif | |
| 15 | ||
| 16 | /** | |
| 17 | * RGB color value. | |
| 18 | * | |
| 19 | * @ingroup sgr | |
| 20 | */ | |
| 21 | typedef struct { | |
| 22 | uint8_t r; /**< Red component (0-255) */ | |
| 23 | uint8_t g; /**< Green component (0-255) */ | |
| 24 | uint8_t b; /**< Blue component (0-255) */ | |
| 25 | } GhosttyColorRgb; | |
| 26 | ||
| 27 | /** | |
| 28 | * Palette color index (0-255). | |
| 29 | * | |
| 30 | * @ingroup sgr | |
| 31 | */ | |
| 32 | typedef uint8_t GhosttyColorPaletteIndex; | |
| 33 | ||
| 34 | /** @addtogroup sgr | |
| 35 | * @{ | |
| 36 | */ | |
| 37 | ||
| 38 | /** Black color (0) @ingroup sgr */ | |
| 39 | #define GHOSTTY_COLOR_NAMED_BLACK 0 | |
| 40 | /** Red color (1) @ingroup sgr */ | |
| 41 | #define GHOSTTY_COLOR_NAMED_RED 1 | |
| 42 | /** Green color (2) @ingroup sgr */ | |
| 43 | #define GHOSTTY_COLOR_NAMED_GREEN 2 | |
| 44 | /** Yellow color (3) @ingroup sgr */ | |
| 45 | #define GHOSTTY_COLOR_NAMED_YELLOW 3 | |
| 46 | /** Blue color (4) @ingroup sgr */ | |
| 47 | #define GHOSTTY_COLOR_NAMED_BLUE 4 | |
| 48 | /** Magenta color (5) @ingroup sgr */ | |
| 49 | #define GHOSTTY_COLOR_NAMED_MAGENTA 5 | |
| 50 | /** Cyan color (6) @ingroup sgr */ | |
| 51 | #define GHOSTTY_COLOR_NAMED_CYAN 6 | |
| 52 | /** White color (7) @ingroup sgr */ | |
| 53 | #define GHOSTTY_COLOR_NAMED_WHITE 7 | |
| 54 | /** Bright black color (8) @ingroup sgr */ | |
| 55 | #define GHOSTTY_COLOR_NAMED_BRIGHT_BLACK 8 | |
| 56 | /** Bright red color (9) @ingroup sgr */ | |
| 57 | #define GHOSTTY_COLOR_NAMED_BRIGHT_RED 9 | |
| 58 | /** Bright green color (10) @ingroup sgr */ | |
| 59 | #define GHOSTTY_COLOR_NAMED_BRIGHT_GREEN 10 | |
| 60 | /** Bright yellow color (11) @ingroup sgr */ | |
| 61 | #define GHOSTTY_COLOR_NAMED_BRIGHT_YELLOW 11 | |
| 62 | /** Bright blue color (12) @ingroup sgr */ | |
| 63 | #define GHOSTTY_COLOR_NAMED_BRIGHT_BLUE 12 | |
| 64 | /** Bright magenta color (13) @ingroup sgr */ | |
| 65 | #define GHOSTTY_COLOR_NAMED_BRIGHT_MAGENTA 13 | |
| 66 | /** Bright cyan color (14) @ingroup sgr */ | |
| 67 | #define GHOSTTY_COLOR_NAMED_BRIGHT_CYAN 14 | |
| 68 | /** Bright white color (15) @ingroup sgr */ | |
| 69 | #define GHOSTTY_COLOR_NAMED_BRIGHT_WHITE 15 | |
| 70 | ||
| 71 | /** @} */ | |
| 72 | ||
| 73 | /** | |
| 74 | * Get the RGB color components. | |
| 75 | * | |
| 76 | * This function extracts the individual red, green, and blue components | |
| 77 | * from a GhosttyColorRgb value. Primarily useful in WebAssembly environments | |
| 78 | * where accessing struct fields directly is difficult. | |
| 79 | * | |
| 80 | * @param color The RGB color value | |
| 81 | * @param r Pointer to store the red component (0-255) | |
| 82 | * @param g Pointer to store the green component (0-255) | |
| 83 | * @param b Pointer to store the blue component (0-255) | |
| 84 | * | |
| 85 | * @ingroup sgr | |
| 86 | */ | |
| 87 | void ghostty_color_rgb_get(GhosttyColorRgb color, | |
| 88 | uint8_t* r, | |
| 89 | uint8_t* g, | |
| 90 | uint8_t* b); | |
| 91 | ||
| 92 | #ifdef __cplusplus | |
| 93 | } | |
| 94 | #endif | |
| 95 | ||
| 96 | #endif /* GHOSTTY_VT_COLOR_H */ |
apps/mobile/modules/t3-terminal/Vendor/libghostty/GhosttyKit.xcframework/ios-arm64-simulator/Headers/ghostty/vt/key.h deleted-80| ... | ... | @@ -1,80 +0,0 @@ |
| 1 | /** | |
| 2 | * @file key.h | |
| 3 | * | |
| 4 | * Key encoding module - encode key events into terminal escape sequences. | |
| 5 | */ | |
| 6 | ||
| 7 | #ifndef GHOSTTY_VT_KEY_H | |
| 8 | #define GHOSTTY_VT_KEY_H | |
| 9 | ||
| 10 | /** @defgroup key Key Encoding | |
| 11 | * | |
| 12 | * Utilities for encoding key events into terminal escape sequences, | |
| 13 | * supporting both legacy encoding as well as Kitty Keyboard Protocol. | |
| 14 | * | |
| 15 | * ## Basic Usage | |
| 16 | * | |
| 17 | * 1. Create an encoder instance with ghostty_key_encoder_new() | |
| 18 | * 2. Configure encoder options with ghostty_key_encoder_setopt(). | |
| 19 | * 3. For each key event: | |
| 20 | * - Create a key event with ghostty_key_event_new() | |
| 21 | * - Set event properties (action, key, modifiers, etc.) | |
| 22 | * - Encode with ghostty_key_encoder_encode() | |
| 23 | * - Free the event with ghostty_key_event_free() | |
| 24 | * - Note: You can also reuse the same key event multiple times by | |
| 25 | * changing its properties. | |
| 26 | * 4. Free the encoder with ghostty_key_encoder_free() when done | |
| 27 | * | |
| 28 | * ## Example | |
| 29 | * | |
| 30 | * @code{.c} | |
| 31 | * #include <assert.h> | |
| 32 | * #include <stdio.h> | |
| 33 | * #include <ghostty/vt.h> | |
| 34 | * | |
| 35 | * int main() { | |
| 36 | * // Create encoder | |
| 37 | * GhosttyKeyEncoder encoder; | |
| 38 | * GhosttyResult result = ghostty_key_encoder_new(NULL, &encoder); | |
| 39 | * assert(result == GHOSTTY_SUCCESS); | |
| 40 | * | |
| 41 | * // Enable Kitty keyboard protocol with all features | |
| 42 | * ghostty_key_encoder_setopt(encoder, GHOSTTY_KEY_ENCODER_OPT_KITTY_FLAGS, | |
| 43 | * &(uint8_t){GHOSTTY_KITTY_KEY_ALL}); | |
| 44 | * | |
| 45 | * // Create and configure key event for Ctrl+C press | |
| 46 | * GhosttyKeyEvent event; | |
| 47 | * result = ghostty_key_event_new(NULL, &event); | |
| 48 | * assert(result == GHOSTTY_SUCCESS); | |
| 49 | * ghostty_key_event_set_action(event, GHOSTTY_KEY_ACTION_PRESS); | |
| 50 | * ghostty_key_event_set_key(event, GHOSTTY_KEY_C); | |
| 51 | * ghostty_key_event_set_mods(event, GHOSTTY_MODS_CTRL); | |
| 52 | * | |
| 53 | * // Encode the key event | |
| 54 | * char buf[128]; | |
| 55 | * size_t written = 0; | |
| 56 | * result = ghostty_key_encoder_encode(encoder, event, buf, sizeof(buf), &written); | |
| 57 | * assert(result == GHOSTTY_SUCCESS); | |
| 58 | * | |
| 59 | * // Use the encoded sequence (e.g., write to terminal) | |
| 60 | * fwrite(buf, 1, written, stdout); | |
| 61 | * | |
| 62 | * // Cleanup | |
| 63 | * ghostty_key_event_free(event); | |
| 64 | * ghostty_key_encoder_free(encoder); | |
| 65 | * return 0; | |
| 66 | * } | |
| 67 | * @endcode | |
| 68 | * | |
| 69 | * For a complete working example, see example/c-vt-key-encode in the | |
| 70 | * repository. | |
| 71 | * | |
| 72 | * @{ | |
| 73 | */ | |
| 74 | ||
| 75 | #include <ghostty/vt/key/event.h> | |
| 76 | #include <ghostty/vt/key/encoder.h> | |
| 77 | ||
| 78 | /** @} */ | |
| 79 | ||
| 80 | #endif /* GHOSTTY_VT_KEY_H */ |
apps/mobile/modules/t3-terminal/Vendor/libghostty/GhosttyKit.xcframework/ios-arm64-simulator/Headers/ghostty/vt/key/encoder.h deleted-221| ... | ... | @@ -1,221 +0,0 @@ |
| 1 | /** | |
| 2 | * @file encoder.h | |
| 3 | * | |
| 4 | * Key event encoding to terminal escape sequences. | |
| 5 | */ | |
| 6 | ||
| 7 | #ifndef GHOSTTY_VT_KEY_ENCODER_H | |
| 8 | #define GHOSTTY_VT_KEY_ENCODER_H | |
| 9 | ||
| 10 | #include <stddef.h> | |
| 11 | #include <stdint.h> | |
| 12 | #include <ghostty/vt/result.h> | |
| 13 | #include <ghostty/vt/allocator.h> | |
| 14 | #include <ghostty/vt/key/event.h> | |
| 15 | ||
| 16 | /** | |
| 17 | * Opaque handle to a key encoder instance. | |
| 18 | * | |
| 19 | * This handle represents a key encoder that converts key events into terminal | |
| 20 | * escape sequences. | |
| 21 | * | |
| 22 | * @ingroup key | |
| 23 | */ | |
| 24 | typedef struct GhosttyKeyEncoder *GhosttyKeyEncoder; | |
| 25 | ||
| 26 | /** | |
| 27 | * Kitty keyboard protocol flags. | |
| 28 | * | |
| 29 | * Bitflags representing the various modes of the Kitty keyboard protocol. | |
| 30 | * These can be combined using bitwise OR operations. Valid values all | |
| 31 | * start with `GHOSTTY_KITTY_KEY_`. | |
| 32 | * | |
| 33 | * @ingroup key | |
| 34 | */ | |
| 35 | typedef uint8_t GhosttyKittyKeyFlags; | |
| 36 | ||
| 37 | /** Kitty keyboard protocol disabled (all flags off) */ | |
| 38 | #define GHOSTTY_KITTY_KEY_DISABLED 0 | |
| 39 | ||
| 40 | /** Disambiguate escape codes */ | |
| 41 | #define GHOSTTY_KITTY_KEY_DISAMBIGUATE (1 << 0) | |
| 42 | ||
| 43 | /** Report key press and release events */ | |
| 44 | #define GHOSTTY_KITTY_KEY_REPORT_EVENTS (1 << 1) | |
| 45 | ||
| 46 | /** Report alternate key codes */ | |
| 47 | #define GHOSTTY_KITTY_KEY_REPORT_ALTERNATES (1 << 2) | |
| 48 | ||
| 49 | /** Report all key events including those normally handled by the terminal */ | |
| 50 | #define GHOSTTY_KITTY_KEY_REPORT_ALL (1 << 3) | |
| 51 | ||
| 52 | /** Report associated text with key events */ | |
| 53 | #define GHOSTTY_KITTY_KEY_REPORT_ASSOCIATED (1 << 4) | |
| 54 | ||
| 55 | /** All Kitty keyboard protocol flags enabled */ | |
| 56 | #define GHOSTTY_KITTY_KEY_ALL (GHOSTTY_KITTY_KEY_DISAMBIGUATE | GHOSTTY_KITTY_KEY_REPORT_EVENTS | GHOSTTY_KITTY_KEY_REPORT_ALTERNATES | GHOSTTY_KITTY_KEY_REPORT_ALL | GHOSTTY_KITTY_KEY_REPORT_ASSOCIATED) | |
| 57 | ||
| 58 | /** | |
| 59 | * macOS option key behavior. | |
| 60 | * | |
| 61 | * Determines whether the "option" key on macOS is treated as "alt" or not. | |
| 62 | * See the Ghostty `macos-option-as-alt` configuration option for more details. | |
| 63 | * | |
| 64 | * @ingroup key | |
| 65 | */ | |
| 66 | typedef enum { | |
| 67 | /** Option key is not treated as alt */ | |
| 68 | GHOSTTY_OPTION_AS_ALT_FALSE = 0, | |
| 69 | /** Option key is treated as alt */ | |
| 70 | GHOSTTY_OPTION_AS_ALT_TRUE = 1, | |
| 71 | /** Only left option key is treated as alt */ | |
| 72 | GHOSTTY_OPTION_AS_ALT_LEFT = 2, | |
| 73 | /** Only right option key is treated as alt */ | |
| 74 | GHOSTTY_OPTION_AS_ALT_RIGHT = 3, | |
| 75 | } GhosttyOptionAsAlt; | |
| 76 | ||
| 77 | /** | |
| 78 | * Key encoder option identifiers. | |
| 79 | * | |
| 80 | * These values are used with ghostty_key_encoder_setopt() to configure | |
| 81 | * the behavior of the key encoder. | |
| 82 | * | |
| 83 | * @ingroup key | |
| 84 | */ | |
| 85 | typedef enum { | |
| 86 | /** Terminal DEC mode 1: cursor key application mode (value: bool) */ | |
| 87 | GHOSTTY_KEY_ENCODER_OPT_CURSOR_KEY_APPLICATION = 0, | |
| 88 | ||
| 89 | /** Terminal DEC mode 66: keypad key application mode (value: bool) */ | |
| 90 | GHOSTTY_KEY_ENCODER_OPT_KEYPAD_KEY_APPLICATION = 1, | |
| 91 | ||
| 92 | /** Terminal DEC mode 1035: ignore keypad with numlock (value: bool) */ | |
| 93 | GHOSTTY_KEY_ENCODER_OPT_IGNORE_KEYPAD_WITH_NUMLOCK = 2, | |
| 94 | ||
| 95 | /** Terminal DEC mode 1036: alt sends escape prefix (value: bool) */ | |
| 96 | GHOSTTY_KEY_ENCODER_OPT_ALT_ESC_PREFIX = 3, | |
| 97 | ||
| 98 | /** xterm modifyOtherKeys mode 2 (value: bool) */ | |
| 99 | GHOSTTY_KEY_ENCODER_OPT_MODIFY_OTHER_KEYS_STATE_2 = 4, | |
| 100 | ||
| 101 | /** Kitty keyboard protocol flags (value: GhosttyKittyKeyFlags bitmask) */ | |
| 102 | GHOSTTY_KEY_ENCODER_OPT_KITTY_FLAGS = 5, | |
| 103 | ||
| 104 | /** macOS option-as-alt setting (value: GhosttyOptionAsAlt) */ | |
| 105 | GHOSTTY_KEY_ENCODER_OPT_MACOS_OPTION_AS_ALT = 6, | |
| 106 | } GhosttyKeyEncoderOption; | |
| 107 | ||
| 108 | /** | |
| 109 | * Create a new key encoder instance. | |
| 110 | * | |
| 111 | * Creates a new key encoder with default options. The encoder can be configured | |
| 112 | * using ghostty_key_encoder_setopt() and must be freed using | |
| 113 | * ghostty_key_encoder_free() when no longer needed. | |
| 114 | * | |
| 115 | * @param allocator Pointer to the allocator to use for memory management, or NULL to use the default allocator | |
| 116 | * @param encoder Pointer to store the created encoder handle | |
| 117 | * @return GHOSTTY_SUCCESS on success, or an error code on failure | |
| 118 | * | |
| 119 | * @ingroup key | |
| 120 | */ | |
| 121 | GhosttyResult ghostty_key_encoder_new(const GhosttyAllocator *allocator, GhosttyKeyEncoder *encoder); | |
| 122 | ||
| 123 | /** | |
| 124 | * Free a key encoder instance. | |
| 125 | * | |
| 126 | * Releases all resources associated with the key encoder. After this call, | |
| 127 | * the encoder handle becomes invalid and must not be used. | |
| 128 | * | |
| 129 | * @param encoder The encoder handle to free (may be NULL) | |
| 130 | * | |
| 131 | * @ingroup key | |
| 132 | */ | |
| 133 | void ghostty_key_encoder_free(GhosttyKeyEncoder encoder); | |
| 134 | ||
| 135 | /** | |
| 136 | * Set an option on the key encoder. | |
| 137 | * | |
| 138 | * Configures the behavior of the key encoder. Options control various aspects | |
| 139 | * of encoding such as terminal modes (cursor key application mode, keypad mode), | |
| 140 | * protocol selection (Kitty keyboard protocol flags), and platform-specific | |
| 141 | * behaviors (macOS option-as-alt). | |
| 142 | * | |
| 143 | * A null pointer value does nothing. It does not reset the value to the | |
| 144 | * default. The setopt call will do nothing. | |
| 145 | * | |
| 146 | * @param encoder The encoder handle, must not be NULL | |
| 147 | * @param option The option to set | |
| 148 | * @param value Pointer to the value to set (type depends on the option) | |
| 149 | * | |
| 150 | * @ingroup key | |
| 151 | */ | |
| 152 | void ghostty_key_encoder_setopt(GhosttyKeyEncoder encoder, GhosttyKeyEncoderOption option, const void *value); | |
| 153 | ||
| 154 | /** | |
| 155 | * Encode a key event into a terminal escape sequence. | |
| 156 | * | |
| 157 | * Converts a key event into the appropriate terminal escape sequence based on | |
| 158 | * the encoder's current options. The sequence is written to the provided buffer. | |
| 159 | * | |
| 160 | * Not all key events produce output. For example, unmodified modifier keys | |
| 161 | * typically don't generate escape sequences. Check the out_len parameter to | |
| 162 | * determine if any data was written. | |
| 163 | * | |
| 164 | * If the output buffer is too small, this function returns GHOSTTY_OUT_OF_MEMORY | |
| 165 | * and out_len will contain the required buffer size. The caller can then | |
| 166 | * allocate a larger buffer and call the function again. | |
| 167 | * | |
| 168 | * @param encoder The encoder handle, must not be NULL | |
| 169 | * @param event The key event to encode, must not be NULL | |
| 170 | * @param out_buf Buffer to write the encoded sequence to | |
| 171 | * @param out_buf_size Size of the output buffer in bytes | |
| 172 | * @param out_len Pointer to store the number of bytes written (may be NULL) | |
| 173 | * @return GHOSTTY_SUCCESS on success, GHOSTTY_OUT_OF_MEMORY if buffer too small, or other error code | |
| 174 | * | |
| 175 | * ## Example: Calculate required buffer size | |
| 176 | * | |
| 177 | * @code{.c} | |
| 178 | * // Query the required size with a NULL buffer (always returns OUT_OF_MEMORY) | |
| 179 | * size_t required = 0; | |
| 180 | * GhosttyResult result = ghostty_key_encoder_encode(encoder, event, NULL, 0, &required); | |
| 181 | * assert(result == GHOSTTY_OUT_OF_MEMORY); | |
| 182 | * | |
| 183 | * // Allocate buffer of required size | |
| 184 | * char *buf = malloc(required); | |
| 185 | * | |
| 186 | * // Encode with properly sized buffer | |
| 187 | * size_t written = 0; | |
| 188 | * result = ghostty_key_encoder_encode(encoder, event, buf, required, &written); | |
| 189 | * assert(result == GHOSTTY_SUCCESS); | |
| 190 | * | |
| 191 | * // Use the encoded sequence... | |
| 192 | * | |
| 193 | * free(buf); | |
| 194 | * @endcode | |
| 195 | * | |
| 196 | * ## Example: Direct encoding with static buffer | |
| 197 | * | |
| 198 | * @code{.c} | |
| 199 | * // Most escape sequences are short, so a static buffer often suffices | |
| 200 | * char buf[128]; | |
| 201 | * size_t written = 0; | |
| 202 | * GhosttyResult result = ghostty_key_encoder_encode(encoder, event, buf, sizeof(buf), &written); | |
| 203 | * | |
| 204 | * if (result == GHOSTTY_SUCCESS) { | |
| 205 | * // Write the encoded sequence to the terminal | |
| 206 | * write(pty_fd, buf, written); | |
| 207 | * } else if (result == GHOSTTY_OUT_OF_MEMORY) { | |
| 208 | * // Buffer too small, written contains required size | |
| 209 | * char *dynamic_buf = malloc(written); | |
| 210 | * result = ghostty_key_encoder_encode(encoder, event, dynamic_buf, written, &written); | |
| 211 | * assert(result == GHOSTTY_SUCCESS); | |
| 212 | * write(pty_fd, dynamic_buf, written); | |
| 213 | * free(dynamic_buf); | |
| 214 | * } | |
| 215 | * @endcode | |
| 216 | * | |
| 217 | * @ingroup key | |
| 218 | */ | |
| 219 | GhosttyResult ghostty_key_encoder_encode(GhosttyKeyEncoder encoder, GhosttyKeyEvent event, char *out_buf, size_t out_buf_size, size_t *out_len); | |
| 220 | ||
| 221 | #endif /* GHOSTTY_VT_KEY_ENCODER_H */ |
apps/mobile/modules/t3-terminal/Vendor/libghostty/GhosttyKit.xcframework/ios-arm64-simulator/Headers/ghostty/vt/key/event.h deleted-474| ... | ... | @@ -1,474 +0,0 @@ |
| 1 | /** | |
| 2 | * @file event.h | |
| 3 | * | |
| 4 | * Key event representation and manipulation. | |
| 5 | */ | |
| 6 | ||
| 7 | #ifndef GHOSTTY_VT_KEY_EVENT_H | |
| 8 | #define GHOSTTY_VT_KEY_EVENT_H | |
| 9 | ||
| 10 | #include <stdbool.h> | |
| 11 | #include <stddef.h> | |
| 12 | #include <stdint.h> | |
| 13 | #include <ghostty/vt/result.h> | |
| 14 | #include <ghostty/vt/allocator.h> | |
| 15 | ||
| 16 | /** | |
| 17 | * Opaque handle to a key event. | |
| 18 | * | |
| 19 | * This handle represents a keyboard input event containing information about | |
| 20 | * the physical key pressed, modifiers, and generated text. | |
| 21 | * | |
| 22 | * @ingroup key | |
| 23 | */ | |
| 24 | typedef struct GhosttyKeyEvent *GhosttyKeyEvent; | |
| 25 | ||
| 26 | /** | |
| 27 | * Keyboard input event types. | |
| 28 | * | |
| 29 | * @ingroup key | |
| 30 | */ | |
| 31 | typedef enum { | |
| 32 | /** Key was released */ | |
| 33 | GHOSTTY_KEY_ACTION_RELEASE = 0, | |
| 34 | /** Key was pressed */ | |
| 35 | GHOSTTY_KEY_ACTION_PRESS = 1, | |
| 36 | /** Key is being repeated (held down) */ | |
| 37 | GHOSTTY_KEY_ACTION_REPEAT = 2, | |
| 38 | } GhosttyKeyAction; | |
| 39 | ||
| 40 | /** | |
| 41 | * Keyboard modifier keys bitmask. | |
| 42 | * | |
| 43 | * A bitmask representing all keyboard modifiers. This tracks which modifier keys | |
| 44 | * are pressed and, where supported by the platform, which side (left or right) | |
| 45 | * of each modifier is active. | |
| 46 | * | |
| 47 | * Use the GHOSTTY_MODS_* constants to test and set individual modifiers. | |
| 48 | * | |
| 49 | * Modifier side bits are only meaningful when the corresponding modifier bit is set. | |
| 50 | * Not all platforms support distinguishing between left and right modifier | |
| 51 | * keys and Ghostty is built to expect that some platforms may not provide this | |
| 52 | * information. | |
| 53 | * | |
| 54 | * @ingroup key | |
| 55 | */ | |
| 56 | typedef uint16_t GhosttyMods; | |
| 57 | ||
| 58 | /** Shift key is pressed */ | |
| 59 | #define GHOSTTY_MODS_SHIFT (1 << 0) | |
| 60 | /** Control key is pressed */ | |
| 61 | #define GHOSTTY_MODS_CTRL (1 << 1) | |
| 62 | /** Alt/Option key is pressed */ | |
| 63 | #define GHOSTTY_MODS_ALT (1 << 2) | |
| 64 | /** Super/Command/Windows key is pressed */ | |
| 65 | #define GHOSTTY_MODS_SUPER (1 << 3) | |
| 66 | /** Caps Lock is active */ | |
| 67 | #define GHOSTTY_MODS_CAPS_LOCK (1 << 4) | |
| 68 | /** Num Lock is active */ | |
| 69 | #define GHOSTTY_MODS_NUM_LOCK (1 << 5) | |
| 70 | ||
| 71 | /** | |
| 72 | * Right shift is pressed (0 = left, 1 = right). | |
| 73 | * Only meaningful when GHOSTTY_MODS_SHIFT is set. | |
| 74 | */ | |
| 75 | #define GHOSTTY_MODS_SHIFT_SIDE (1 << 6) | |
| 76 | /** | |
| 77 | * Right ctrl is pressed (0 = left, 1 = right). | |
| 78 | * Only meaningful when GHOSTTY_MODS_CTRL is set. | |
| 79 | */ | |
| 80 | #define GHOSTTY_MODS_CTRL_SIDE (1 << 7) | |
| 81 | /** | |
| 82 | * Right alt is pressed (0 = left, 1 = right). | |
| 83 | * Only meaningful when GHOSTTY_MODS_ALT is set. | |
| 84 | */ | |
| 85 | #define GHOSTTY_MODS_ALT_SIDE (1 << 8) | |
| 86 | /** | |
| 87 | * Right super is pressed (0 = left, 1 = right). | |
| 88 | * Only meaningful when GHOSTTY_MODS_SUPER is set. | |
| 89 | */ | |
| 90 | #define GHOSTTY_MODS_SUPER_SIDE (1 << 9) | |
| 91 | ||
| 92 | /** | |
| 93 | * Physical key codes. | |
| 94 | * | |
| 95 | * The set of key codes that Ghostty is aware of. These represent physical keys | |
| 96 | * on the keyboard and are layout-independent. For example, the "a" key on a US | |
| 97 | * keyboard is the same as the "ф" key on a Russian keyboard, but both will | |
| 98 | * report the same key_a value. | |
| 99 | * | |
| 100 | * Layout-dependent strings are provided separately as UTF-8 text and are produced | |
| 101 | * by the platform. These values are based on the W3C UI Events KeyboardEvent code | |
| 102 | * standard. See: https://www.w3.org/TR/uievents-code | |
| 103 | * | |
| 104 | * @ingroup key | |
| 105 | */ | |
| 106 | typedef enum { | |
| 107 | GHOSTTY_KEY_UNIDENTIFIED = 0, | |
| 108 | ||
| 109 | // Writing System Keys (W3C § 3.1.1) | |
| 110 | GHOSTTY_KEY_BACKQUOTE, | |
| 111 | GHOSTTY_KEY_BACKSLASH, | |
| 112 | GHOSTTY_KEY_BRACKET_LEFT, | |
| 113 | GHOSTTY_KEY_BRACKET_RIGHT, | |
| 114 | GHOSTTY_KEY_COMMA, | |
| 115 | GHOSTTY_KEY_DIGIT_0, | |
| 116 | GHOSTTY_KEY_DIGIT_1, | |
| 117 | GHOSTTY_KEY_DIGIT_2, | |
| 118 | GHOSTTY_KEY_DIGIT_3, | |
| 119 | GHOSTTY_KEY_DIGIT_4, | |
| 120 | GHOSTTY_KEY_DIGIT_5, | |
| 121 | GHOSTTY_KEY_DIGIT_6, | |
| 122 | GHOSTTY_KEY_DIGIT_7, | |
| 123 | GHOSTTY_KEY_DIGIT_8, | |
| 124 | GHOSTTY_KEY_DIGIT_9, | |
| 125 | GHOSTTY_KEY_EQUAL, | |
| 126 | GHOSTTY_KEY_INTL_BACKSLASH, | |
| 127 | GHOSTTY_KEY_INTL_RO, | |
| 128 | GHOSTTY_KEY_INTL_YEN, | |
| 129 | GHOSTTY_KEY_A, | |
| 130 | GHOSTTY_KEY_B, | |
| 131 | GHOSTTY_KEY_C, | |
| 132 | GHOSTTY_KEY_D, | |
| 133 | GHOSTTY_KEY_E, | |
| 134 | GHOSTTY_KEY_F, | |
| 135 | GHOSTTY_KEY_G, | |
| 136 | GHOSTTY_KEY_H, | |
| 137 | GHOSTTY_KEY_I, | |
| 138 | GHOSTTY_KEY_J, | |
| 139 | GHOSTTY_KEY_K, | |
| 140 | GHOSTTY_KEY_L, | |
| 141 | GHOSTTY_KEY_M, | |
| 142 | GHOSTTY_KEY_N, | |
| 143 | GHOSTTY_KEY_O, | |
| 144 | GHOSTTY_KEY_P, | |
| 145 | GHOSTTY_KEY_Q, | |
| 146 | GHOSTTY_KEY_R, | |
| 147 | GHOSTTY_KEY_S, | |
| 148 | GHOSTTY_KEY_T, | |
| 149 | GHOSTTY_KEY_U, | |
| 150 | GHOSTTY_KEY_V, | |
| 151 | GHOSTTY_KEY_W, | |
| 152 | GHOSTTY_KEY_X, | |
| 153 | GHOSTTY_KEY_Y, | |
| 154 | GHOSTTY_KEY_Z, | |
| 155 | GHOSTTY_KEY_MINUS, | |
| 156 | GHOSTTY_KEY_PERIOD, | |
| 157 | GHOSTTY_KEY_QUOTE, | |
| 158 | GHOSTTY_KEY_SEMICOLON, | |
| 159 | GHOSTTY_KEY_SLASH, | |
| 160 | ||
| 161 | // Functional Keys (W3C § 3.1.2) | |
| 162 | GHOSTTY_KEY_ALT_LEFT, | |
| 163 | GHOSTTY_KEY_ALT_RIGHT, | |
| 164 | GHOSTTY_KEY_BACKSPACE, | |
| 165 | GHOSTTY_KEY_CAPS_LOCK, | |
| 166 | GHOSTTY_KEY_CONTEXT_MENU, | |
| 167 | GHOSTTY_KEY_CONTROL_LEFT, | |
| 168 | GHOSTTY_KEY_CONTROL_RIGHT, | |
| 169 | GHOSTTY_KEY_ENTER, | |
| 170 | GHOSTTY_KEY_META_LEFT, | |
| 171 | GHOSTTY_KEY_META_RIGHT, | |
| 172 | GHOSTTY_KEY_SHIFT_LEFT, | |
| 173 | GHOSTTY_KEY_SHIFT_RIGHT, | |
| 174 | GHOSTTY_KEY_SPACE, | |
| 175 | GHOSTTY_KEY_TAB, | |
| 176 | GHOSTTY_KEY_CONVERT, | |
| 177 | GHOSTTY_KEY_KANA_MODE, | |
| 178 | GHOSTTY_KEY_NON_CONVERT, | |
| 179 | ||
| 180 | // Control Pad Section (W3C § 3.2) | |
| 181 | GHOSTTY_KEY_DELETE, | |
| 182 | GHOSTTY_KEY_END, | |
| 183 | GHOSTTY_KEY_HELP, | |
| 184 | GHOSTTY_KEY_HOME, | |
| 185 | GHOSTTY_KEY_INSERT, | |
| 186 | GHOSTTY_KEY_PAGE_DOWN, | |
| 187 | GHOSTTY_KEY_PAGE_UP, | |
| 188 | ||
| 189 | // Arrow Pad Section (W3C § 3.3) | |
| 190 | GHOSTTY_KEY_ARROW_DOWN, | |
| 191 | GHOSTTY_KEY_ARROW_LEFT, | |
| 192 | GHOSTTY_KEY_ARROW_RIGHT, | |
| 193 | GHOSTTY_KEY_ARROW_UP, | |
| 194 | ||
| 195 | // Numpad Section (W3C § 3.4) | |
| 196 | GHOSTTY_KEY_NUM_LOCK, | |
| 197 | GHOSTTY_KEY_NUMPAD_0, | |
| 198 | GHOSTTY_KEY_NUMPAD_1, | |
| 199 | GHOSTTY_KEY_NUMPAD_2, | |
| 200 | GHOSTTY_KEY_NUMPAD_3, | |
| 201 | GHOSTTY_KEY_NUMPAD_4, | |
| 202 | GHOSTTY_KEY_NUMPAD_5, | |
| 203 | GHOSTTY_KEY_NUMPAD_6, | |
| 204 | GHOSTTY_KEY_NUMPAD_7, | |
| 205 | GHOSTTY_KEY_NUMPAD_8, | |
| 206 | GHOSTTY_KEY_NUMPAD_9, | |
| 207 | GHOSTTY_KEY_NUMPAD_ADD, | |
| 208 | GHOSTTY_KEY_NUMPAD_BACKSPACE, | |
| 209 | GHOSTTY_KEY_NUMPAD_CLEAR, | |
| 210 | GHOSTTY_KEY_NUMPAD_CLEAR_ENTRY, | |
| 211 | GHOSTTY_KEY_NUMPAD_COMMA, | |
| 212 | GHOSTTY_KEY_NUMPAD_DECIMAL, | |
| 213 | GHOSTTY_KEY_NUMPAD_DIVIDE, | |
| 214 | GHOSTTY_KEY_NUMPAD_ENTER, | |
| 215 | GHOSTTY_KEY_NUMPAD_EQUAL, | |
| 216 | GHOSTTY_KEY_NUMPAD_MEMORY_ADD, | |
| 217 | GHOSTTY_KEY_NUMPAD_MEMORY_CLEAR, | |
| 218 | GHOSTTY_KEY_NUMPAD_MEMORY_RECALL, | |
| 219 | GHOSTTY_KEY_NUMPAD_MEMORY_STORE, | |
| 220 | GHOSTTY_KEY_NUMPAD_MEMORY_SUBTRACT, | |
| 221 | GHOSTTY_KEY_NUMPAD_MULTIPLY, | |
| 222 | GHOSTTY_KEY_NUMPAD_PAREN_LEFT, | |
| 223 | GHOSTTY_KEY_NUMPAD_PAREN_RIGHT, | |
| 224 | GHOSTTY_KEY_NUMPAD_SUBTRACT, | |
| 225 | GHOSTTY_KEY_NUMPAD_SEPARATOR, | |
| 226 | GHOSTTY_KEY_NUMPAD_UP, | |
| 227 | GHOSTTY_KEY_NUMPAD_DOWN, | |
| 228 | GHOSTTY_KEY_NUMPAD_RIGHT, | |
| 229 | GHOSTTY_KEY_NUMPAD_LEFT, | |
| 230 | GHOSTTY_KEY_NUMPAD_BEGIN, | |
| 231 | GHOSTTY_KEY_NUMPAD_HOME, | |
| 232 | GHOSTTY_KEY_NUMPAD_END, | |
| 233 | GHOSTTY_KEY_NUMPAD_INSERT, | |
| 234 | GHOSTTY_KEY_NUMPAD_DELETE, | |
| 235 | GHOSTTY_KEY_NUMPAD_PAGE_UP, | |
| 236 | GHOSTTY_KEY_NUMPAD_PAGE_DOWN, | |
| 237 | ||
| 238 | // Function Section (W3C § 3.5) | |
| 239 | GHOSTTY_KEY_ESCAPE, | |
| 240 | GHOSTTY_KEY_F1, | |
| 241 | GHOSTTY_KEY_F2, | |
| 242 | GHOSTTY_KEY_F3, | |
| 243 | GHOSTTY_KEY_F4, | |
| 244 | GHOSTTY_KEY_F5, | |
| 245 | GHOSTTY_KEY_F6, | |
| 246 | GHOSTTY_KEY_F7, | |
| 247 | GHOSTTY_KEY_F8, | |
| 248 | GHOSTTY_KEY_F9, | |
| 249 | GHOSTTY_KEY_F10, | |
| 250 | GHOSTTY_KEY_F11, | |
| 251 | GHOSTTY_KEY_F12, | |
| 252 | GHOSTTY_KEY_F13, | |
| 253 | GHOSTTY_KEY_F14, | |
| 254 | GHOSTTY_KEY_F15, | |
| 255 | GHOSTTY_KEY_F16, | |
| 256 | GHOSTTY_KEY_F17, | |
| 257 | GHOSTTY_KEY_F18, | |
| 258 | GHOSTTY_KEY_F19, | |
| 259 | GHOSTTY_KEY_F20, | |
| 260 | GHOSTTY_KEY_F21, | |
| 261 | GHOSTTY_KEY_F22, | |
| 262 | GHOSTTY_KEY_F23, | |
| 263 | GHOSTTY_KEY_F24, | |
| 264 | GHOSTTY_KEY_F25, | |
| 265 | GHOSTTY_KEY_FN, | |
| 266 | GHOSTTY_KEY_FN_LOCK, | |
| 267 | GHOSTTY_KEY_PRINT_SCREEN, | |
| 268 | GHOSTTY_KEY_SCROLL_LOCK, | |
| 269 | GHOSTTY_KEY_PAUSE, | |
| 270 | ||
| 271 | // Media Keys (W3C § 3.6) | |
| 272 | GHOSTTY_KEY_BROWSER_BACK, | |
| 273 | GHOSTTY_KEY_BROWSER_FAVORITES, | |
| 274 | GHOSTTY_KEY_BROWSER_FORWARD, | |
| 275 | GHOSTTY_KEY_BROWSER_HOME, | |
| 276 | GHOSTTY_KEY_BROWSER_REFRESH, | |
| 277 | GHOSTTY_KEY_BROWSER_SEARCH, | |
| 278 | GHOSTTY_KEY_BROWSER_STOP, | |
| 279 | GHOSTTY_KEY_EJECT, | |
| 280 | GHOSTTY_KEY_LAUNCH_APP_1, | |
| 281 | GHOSTTY_KEY_LAUNCH_APP_2, | |
| 282 | GHOSTTY_KEY_LAUNCH_MAIL, | |
| 283 | GHOSTTY_KEY_MEDIA_PLAY_PAUSE, | |
| 284 | GHOSTTY_KEY_MEDIA_SELECT, | |
| 285 | GHOSTTY_KEY_MEDIA_STOP, | |
| 286 | GHOSTTY_KEY_MEDIA_TRACK_NEXT, | |
| 287 | GHOSTTY_KEY_MEDIA_TRACK_PREVIOUS, | |
| 288 | GHOSTTY_KEY_POWER, | |
| 289 | GHOSTTY_KEY_SLEEP, | |
| 290 | GHOSTTY_KEY_AUDIO_VOLUME_DOWN, | |
| 291 | GHOSTTY_KEY_AUDIO_VOLUME_MUTE, | |
| 292 | GHOSTTY_KEY_AUDIO_VOLUME_UP, | |
| 293 | GHOSTTY_KEY_WAKE_UP, | |
| 294 | ||
| 295 | // Legacy, Non-standard, and Special Keys (W3C § 3.7) | |
| 296 | GHOSTTY_KEY_COPY, | |
| 297 | GHOSTTY_KEY_CUT, | |
| 298 | GHOSTTY_KEY_PASTE, | |
| 299 | } GhosttyKey; | |
| 300 | ||
| 301 | /** | |
| 302 | * Create a new key event instance. | |
| 303 | * | |
| 304 | * Creates a new key event with default values. The event must be freed using | |
| 305 | * ghostty_key_event_free() when no longer needed. | |
| 306 | * | |
| 307 | * @param allocator Pointer to the allocator to use for memory management, or NULL to use the default allocator | |
| 308 | * @param event Pointer to store the created key event handle | |
| 309 | * @return GHOSTTY_SUCCESS on success, or an error code on failure | |
| 310 | * | |
| 311 | * @ingroup key | |
| 312 | */ | |
| 313 | GhosttyResult ghostty_key_event_new(const GhosttyAllocator *allocator, GhosttyKeyEvent *event); | |
| 314 | ||
| 315 | /** | |
| 316 | * Free a key event instance. | |
| 317 | * | |
| 318 | * Releases all resources associated with the key event. After this call, | |
| 319 | * the event handle becomes invalid and must not be used. | |
| 320 | * | |
| 321 | * @param event The key event handle to free (may be NULL) | |
| 322 | * | |
| 323 | * @ingroup key | |
| 324 | */ | |
| 325 | void ghostty_key_event_free(GhosttyKeyEvent event); | |
| 326 | ||
| 327 | /** | |
| 328 | * Set the key action (press, release, repeat). | |
| 329 | * | |
| 330 | * @param event The key event handle, must not be NULL | |
| 331 | * @param action The action to set | |
| 332 | * | |
| 333 | * @ingroup key | |
| 334 | */ | |
| 335 | void ghostty_key_event_set_action(GhosttyKeyEvent event, GhosttyKeyAction action); | |
| 336 | ||
| 337 | /** | |
| 338 | * Get the key action (press, release, repeat). | |
| 339 | * | |
| 340 | * @param event The key event handle, must not be NULL | |
| 341 | * @return The key action | |
| 342 | * | |
| 343 | * @ingroup key | |
| 344 | */ | |
| 345 | GhosttyKeyAction ghostty_key_event_get_action(GhosttyKeyEvent event); | |
| 346 | ||
| 347 | /** | |
| 348 | * Set the physical key code. | |
| 349 | * | |
| 350 | * @param event The key event handle, must not be NULL | |
| 351 | * @param key The physical key code to set | |
| 352 | * | |
| 353 | * @ingroup key | |
| 354 | */ | |
| 355 | void ghostty_key_event_set_key(GhosttyKeyEvent event, GhosttyKey key); | |
| 356 | ||
| 357 | /** | |
| 358 | * Get the physical key code. | |
| 359 | * | |
| 360 | * @param event The key event handle, must not be NULL | |
| 361 | * @return The physical key code | |
| 362 | * | |
| 363 | * @ingroup key | |
| 364 | */ | |
| 365 | GhosttyKey ghostty_key_event_get_key(GhosttyKeyEvent event); | |
| 366 | ||
| 367 | /** | |
| 368 | * Set the modifier keys bitmask. | |
| 369 | * | |
| 370 | * @param event The key event handle, must not be NULL | |
| 371 | * @param mods The modifier keys bitmask to set | |
| 372 | * | |
| 373 | * @ingroup key | |
| 374 | */ | |
| 375 | void ghostty_key_event_set_mods(GhosttyKeyEvent event, GhosttyMods mods); | |
| 376 | ||
| 377 | /** | |
| 378 | * Get the modifier keys bitmask. | |
| 379 | * | |
| 380 | * @param event The key event handle, must not be NULL | |
| 381 | * @return The modifier keys bitmask | |
| 382 | * | |
| 383 | * @ingroup key | |
| 384 | */ | |
| 385 | GhosttyMods ghostty_key_event_get_mods(GhosttyKeyEvent event); | |
| 386 | ||
| 387 | /** | |
| 388 | * Set the consumed modifiers bitmask. | |
| 389 | * | |
| 390 | * @param event The key event handle, must not be NULL | |
| 391 | * @param consumed_mods The consumed modifiers bitmask to set | |
| 392 | * | |
| 393 | * @ingroup key | |
| 394 | */ | |
| 395 | void ghostty_key_event_set_consumed_mods(GhosttyKeyEvent event, GhosttyMods consumed_mods); | |
| 396 | ||
| 397 | /** | |
| 398 | * Get the consumed modifiers bitmask. | |
| 399 | * | |
| 400 | * @param event The key event handle, must not be NULL | |
| 401 | * @return The consumed modifiers bitmask | |
| 402 | * | |
| 403 | * @ingroup key | |
| 404 | */ | |
| 405 | GhosttyMods ghostty_key_event_get_consumed_mods(GhosttyKeyEvent event); | |
| 406 | ||
| 407 | /** | |
| 408 | * Set whether the key event is part of a composition sequence. | |
| 409 | * | |
| 410 | * @param event The key event handle, must not be NULL | |
| 411 | * @param composing Whether the key event is part of a composition sequence | |
| 412 | * | |
| 413 | * @ingroup key | |
| 414 | */ | |
| 415 | void ghostty_key_event_set_composing(GhosttyKeyEvent event, bool composing); | |
| 416 | ||
| 417 | /** | |
| 418 | * Get whether the key event is part of a composition sequence. | |
| 419 | * | |
| 420 | * @param event The key event handle, must not be NULL | |
| 421 | * @return Whether the key event is part of a composition sequence | |
| 422 | * | |
| 423 | * @ingroup key | |
| 424 | */ | |
| 425 | bool ghostty_key_event_get_composing(GhosttyKeyEvent event); | |
| 426 | ||
| 427 | /** | |
| 428 | * Set the UTF-8 text generated by the key event. | |
| 429 | * | |
| 430 | * The key event does NOT take ownership of the text pointer. The caller | |
| 431 | * must ensure the string remains valid for the lifetime needed by the event. | |
| 432 | * | |
| 433 | * @param event The key event handle, must not be NULL | |
| 434 | * @param utf8 The UTF-8 text to set (or NULL for empty) | |
| 435 | * @param len Length of the UTF-8 text in bytes | |
| 436 | * | |
| 437 | * @ingroup key | |
| 438 | */ | |
| 439 | void ghostty_key_event_set_utf8(GhosttyKeyEvent event, const char *utf8, size_t len); | |
| 440 | ||
| 441 | /** | |
| 442 | * Get the UTF-8 text generated by the key event. | |
| 443 | * | |
| 444 | * The returned pointer is valid until the event is freed or the UTF-8 text is modified. | |
| 445 | * | |
| 446 | * @param event The key event handle, must not be NULL | |
| 447 | * @param len Pointer to store the length of the UTF-8 text in bytes (may be NULL) | |
| 448 | * @return The UTF-8 text (or NULL for empty) | |
| 449 | * | |
| 450 | * @ingroup key | |
| 451 | */ | |
| 452 | const char *ghostty_key_event_get_utf8(GhosttyKeyEvent event, size_t *len); | |
| 453 | ||
| 454 | /** | |
| 455 | * Set the unshifted Unicode codepoint. | |
| 456 | * | |
| 457 | * @param event The key event handle, must not be NULL | |
| 458 | * @param codepoint The unshifted Unicode codepoint to set | |
| 459 | * | |
| 460 | * @ingroup key | |
| 461 | */ | |
| 462 | void ghostty_key_event_set_unshifted_codepoint(GhosttyKeyEvent event, uint32_t codepoint); | |
| 463 | ||
| 464 | /** | |
| 465 | * Get the unshifted Unicode codepoint. | |
| 466 | * | |
| 467 | * @param event The key event handle, must not be NULL | |
| 468 | * @return The unshifted Unicode codepoint | |
| 469 | * | |
| 470 | * @ingroup key | |
| 471 | */ | |
| 472 | uint32_t ghostty_key_event_get_unshifted_codepoint(GhosttyKeyEvent event); | |
| 473 | ||
| 474 | #endif /* GHOSTTY_VT_KEY_EVENT_H */ |
apps/mobile/modules/t3-terminal/Vendor/libghostty/GhosttyKit.xcframework/ios-arm64-simulator/Headers/ghostty/vt/osc.h deleted-233| ... | ... | @@ -1,233 +0,0 @@ |
| 1 | /** | |
| 2 | * @file osc.h | |
| 3 | * | |
| 4 | * OSC (Operating System Command) sequence parser and command handling. | |
| 5 | */ | |
| 6 | ||
| 7 | #ifndef GHOSTTY_VT_OSC_H | |
| 8 | #define GHOSTTY_VT_OSC_H | |
| 9 | ||
| 10 | #include <stdbool.h> | |
| 11 | #include <stddef.h> | |
| 12 | #include <stdint.h> | |
| 13 | #include <ghostty/vt/result.h> | |
| 14 | #include <ghostty/vt/allocator.h> | |
| 15 | ||
| 16 | /** | |
| 17 | * Opaque handle to an OSC parser instance. | |
| 18 | * | |
| 19 | * This handle represents an OSC (Operating System Command) parser that can | |
| 20 | * be used to parse the contents of OSC sequences. | |
| 21 | * | |
| 22 | * @ingroup osc | |
| 23 | */ | |
| 24 | typedef struct GhosttyOscParser *GhosttyOscParser; | |
| 25 | ||
| 26 | /** | |
| 27 | * Opaque handle to a single OSC command. | |
| 28 | * | |
| 29 | * This handle represents a parsed OSC (Operating System Command) command. | |
| 30 | * The command can be queried for its type and associated data. | |
| 31 | * | |
| 32 | * @ingroup osc | |
| 33 | */ | |
| 34 | typedef struct GhosttyOscCommand *GhosttyOscCommand; | |
| 35 | ||
| 36 | /** @defgroup osc OSC Parser | |
| 37 | * | |
| 38 | * OSC (Operating System Command) sequence parser and command handling. | |
| 39 | * | |
| 40 | * The parser operates in a streaming fashion, processing input byte-by-byte | |
| 41 | * to handle OSC sequences that may arrive in fragments across multiple reads. | |
| 42 | * This interface makes it easy to integrate into most environments and avoids | |
| 43 | * over-allocating buffers. | |
| 44 | * | |
| 45 | * ## Basic Usage | |
| 46 | * | |
| 47 | * 1. Create a parser instance with ghostty_osc_new() | |
| 48 | * 2. Feed bytes to the parser using ghostty_osc_next() | |
| 49 | * 3. Finalize parsing with ghostty_osc_end() to get the command | |
| 50 | * 4. Query command type and extract data using ghostty_osc_command_type() | |
| 51 | * and ghostty_osc_command_data() | |
| 52 | * 5. Free the parser with ghostty_osc_free() when done | |
| 53 | * | |
| 54 | * @{ | |
| 55 | */ | |
| 56 | ||
| 57 | /** | |
| 58 | * OSC command types. | |
| 59 | * | |
| 60 | * @ingroup osc | |
| 61 | */ | |
| 62 | typedef enum { | |
| 63 | GHOSTTY_OSC_COMMAND_INVALID = 0, | |
| 64 | GHOSTTY_OSC_COMMAND_CHANGE_WINDOW_TITLE = 1, | |
| 65 | GHOSTTY_OSC_COMMAND_CHANGE_WINDOW_ICON = 2, | |
| 66 | GHOSTTY_OSC_COMMAND_SEMANTIC_PROMPT = 3, | |
| 67 | GHOSTTY_OSC_COMMAND_CLIPBOARD_CONTENTS = 4, | |
| 68 | GHOSTTY_OSC_COMMAND_REPORT_PWD = 5, | |
| 69 | GHOSTTY_OSC_COMMAND_MOUSE_SHAPE = 6, | |
| 70 | GHOSTTY_OSC_COMMAND_COLOR_OPERATION = 7, | |
| 71 | GHOSTTY_OSC_COMMAND_KITTY_COLOR_PROTOCOL = 8, | |
| 72 | GHOSTTY_OSC_COMMAND_SHOW_DESKTOP_NOTIFICATION = 9, | |
| 73 | GHOSTTY_OSC_COMMAND_HYPERLINK_START = 10, | |
| 74 | GHOSTTY_OSC_COMMAND_HYPERLINK_END = 11, | |
| 75 | GHOSTTY_OSC_COMMAND_CONEMU_SLEEP = 12, | |
| 76 | GHOSTTY_OSC_COMMAND_CONEMU_SHOW_MESSAGE_BOX = 13, | |
| 77 | GHOSTTY_OSC_COMMAND_CONEMU_CHANGE_TAB_TITLE = 14, | |
| 78 | GHOSTTY_OSC_COMMAND_CONEMU_PROGRESS_REPORT = 15, | |
| 79 | GHOSTTY_OSC_COMMAND_CONEMU_WAIT_INPUT = 16, | |
| 80 | GHOSTTY_OSC_COMMAND_CONEMU_GUIMACRO = 17, | |
| 81 | GHOSTTY_OSC_COMMAND_CONEMU_RUN_PROCESS = 18, | |
| 82 | GHOSTTY_OSC_COMMAND_CONEMU_OUTPUT_ENVIRONMENT_VARIABLE = 19, | |
| 83 | GHOSTTY_OSC_COMMAND_CONEMU_XTERM_EMULATION = 20, | |
| 84 | GHOSTTY_OSC_COMMAND_CONEMU_COMMENT = 21, | |
| 85 | GHOSTTY_OSC_COMMAND_KITTY_TEXT_SIZING = 22, | |
| 86 | } GhosttyOscCommandType; | |
| 87 | ||
| 88 | /** | |
| 89 | * OSC command data types. | |
| 90 | * | |
| 91 | * These values specify what type of data to extract from an OSC command | |
| 92 | * using `ghostty_osc_command_data`. | |
| 93 | * | |
| 94 | * @ingroup osc | |
| 95 | */ | |
| 96 | typedef enum { | |
| 97 | /** Invalid data type. Never results in any data extraction. */ | |
| 98 | GHOSTTY_OSC_DATA_INVALID = 0, | |
| 99 | ||
| 100 | /** | |
| 101 | * Window title string data. | |
| 102 | * | |
| 103 | * Valid for: GHOSTTY_OSC_COMMAND_CHANGE_WINDOW_TITLE | |
| 104 | * | |
| 105 | * Output type: const char ** (pointer to null-terminated string) | |
| 106 | * | |
| 107 | * Lifetime: Valid until the next call to any ghostty_osc_* function with | |
| 108 | * the same parser instance. Memory is owned by the parser. | |
| 109 | */ | |
| 110 | GHOSTTY_OSC_DATA_CHANGE_WINDOW_TITLE_STR = 1, | |
| 111 | } GhosttyOscCommandData; | |
| 112 | ||
| 113 | /** | |
| 114 | * Create a new OSC parser instance. | |
| 115 | * | |
| 116 | * Creates a new OSC (Operating System Command) parser using the provided | |
| 117 | * allocator. The parser must be freed using ghostty_vt_osc_free() when | |
| 118 | * no longer needed. | |
| 119 | * | |
| 120 | * @param allocator Pointer to the allocator to use for memory management, or NULL to use the default allocator | |
| 121 | * @param parser Pointer to store the created parser handle | |
| 122 | * @return GHOSTTY_SUCCESS on success, or an error code on failure | |
| 123 | * | |
| 124 | * @ingroup osc | |
| 125 | */ | |
| 126 | GhosttyResult ghostty_osc_new(const GhosttyAllocator *allocator, GhosttyOscParser *parser); | |
| 127 | ||
| 128 | /** | |
| 129 | * Free an OSC parser instance. | |
| 130 | * | |
| 131 | * Releases all resources associated with the OSC parser. After this call, | |
| 132 | * the parser handle becomes invalid and must not be used. | |
| 133 | * | |
| 134 | * @param parser The parser handle to free (may be NULL) | |
| 135 | * | |
| 136 | * @ingroup osc | |
| 137 | */ | |
| 138 | void ghostty_osc_free(GhosttyOscParser parser); | |
| 139 | ||
| 140 | /** | |
| 141 | * Reset an OSC parser instance to its initial state. | |
| 142 | * | |
| 143 | * Resets the parser state, clearing any partially parsed OSC sequences | |
| 144 | * and returning the parser to its initial state. This is useful for | |
| 145 | * reusing a parser instance or recovering from parse errors. | |
| 146 | * | |
| 147 | * @param parser The parser handle to reset, must not be null. | |
| 148 | * | |
| 149 | * @ingroup osc | |
| 150 | */ | |
| 151 | void ghostty_osc_reset(GhosttyOscParser parser); | |
| 152 | ||
| 153 | /** | |
| 154 | * Parse the next byte in an OSC sequence. | |
| 155 | * | |
| 156 | * Processes a single byte as part of an OSC sequence. The parser maintains | |
| 157 | * internal state to track the progress through the sequence. Call this | |
| 158 | * function for each byte in the sequence data. | |
| 159 | * | |
| 160 | * When finished pumping the parser with bytes, call ghostty_osc_end | |
| 161 | * to get the final result. | |
| 162 | * | |
| 163 | * @param parser The parser handle, must not be null. | |
| 164 | * @param byte The next byte to parse | |
| 165 | * | |
| 166 | * @ingroup osc | |
| 167 | */ | |
| 168 | void ghostty_osc_next(GhosttyOscParser parser, uint8_t byte); | |
| 169 | ||
| 170 | /** | |
| 171 | * Finalize OSC parsing and retrieve the parsed command. | |
| 172 | * | |
| 173 | * Call this function after feeding all bytes of an OSC sequence to the parser | |
| 174 | * using ghostty_osc_next() with the exception of the terminating character | |
| 175 | * (ESC or ST). This function finalizes the parsing process and returns the | |
| 176 | * parsed OSC command. | |
| 177 | * | |
| 178 | * The return value is never NULL. Invalid commands will return a command | |
| 179 | * with type GHOSTTY_OSC_COMMAND_INVALID. | |
| 180 | * | |
| 181 | * The terminator parameter specifies the byte that terminated the OSC sequence | |
| 182 | * (typically 0x07 for BEL or 0x5C for ST after ESC). This information is | |
| 183 | * preserved in the parsed command so that responses can use the same terminator | |
| 184 | * format for better compatibility with the calling program. For commands that | |
| 185 | * do not require a response, this parameter is ignored and the resulting | |
| 186 | * command will not retain the terminator information. | |
| 187 | * | |
| 188 | * The returned command handle is valid until the next call to any | |
| 189 | * `ghostty_osc_*` function with the same parser instance with the exception | |
| 190 | * of command introspection functions such as `ghostty_osc_command_type`. | |
| 191 | * | |
| 192 | * @param parser The parser handle, must not be null. | |
| 193 | * @param terminator The terminating byte of the OSC sequence (0x07 for BEL, 0x5C for ST) | |
| 194 | * @return Handle to the parsed OSC command | |
| 195 | * | |
| 196 | * @ingroup osc | |
| 197 | */ | |
| 198 | GhosttyOscCommand ghostty_osc_end(GhosttyOscParser parser, uint8_t terminator); | |
| 199 | ||
| 200 | /** | |
| 201 | * Get the type of an OSC command. | |
| 202 | * | |
| 203 | * Returns the type identifier for the given OSC command. This can be used | |
| 204 | * to determine what kind of command was parsed and what data might be | |
| 205 | * available from it. | |
| 206 | * | |
| 207 | * @param command The OSC command handle to query (may be NULL) | |
| 208 | * @return The command type, or GHOSTTY_OSC_COMMAND_INVALID if command is NULL | |
| 209 | * | |
| 210 | * @ingroup osc | |
| 211 | */ | |
| 212 | GhosttyOscCommandType ghostty_osc_command_type(GhosttyOscCommand command); | |
| 213 | ||
| 214 | /** | |
| 215 | * Extract data from an OSC command. | |
| 216 | * | |
| 217 | * Extracts typed data from the given OSC command based on the specified | |
| 218 | * data type. The output pointer must be of the appropriate type for the | |
| 219 | * requested data kind. Valid command types, output types, and memory | |
| 220 | * safety information are documented in the `GhosttyOscCommandData` enum. | |
| 221 | * | |
| 222 | * @param command The OSC command handle to query (may be NULL) | |
| 223 | * @param data The type of data to extract | |
| 224 | * @param out Pointer to store the extracted data (type depends on data parameter) | |
| 225 | * @return true if data extraction was successful, false otherwise | |
| 226 | * | |
| 227 | * @ingroup osc | |
| 228 | */ | |
| 229 | bool ghostty_osc_command_data(GhosttyOscCommand command, GhosttyOscCommandData data, void *out); | |
| 230 | ||
| 231 | /** @} */ | |
| 232 | ||
| 233 | #endif /* GHOSTTY_VT_OSC_H */ |
apps/mobile/modules/t3-terminal/Vendor/libghostty/GhosttyKit.xcframework/ios-arm64-simulator/Headers/ghostty/vt/paste.h deleted-75| ... | ... | @@ -1,75 +0,0 @@ |
| 1 | /** | |
| 2 | * @file paste.h | |
| 3 | * | |
| 4 | * Paste utilities - validate and encode paste data for terminal input. | |
| 5 | */ | |
| 6 | ||
| 7 | #ifndef GHOSTTY_VT_PASTE_H | |
| 8 | #define GHOSTTY_VT_PASTE_H | |
| 9 | ||
| 10 | /** @defgroup paste Paste Utilities | |
| 11 | * | |
| 12 | * Utilities for validating paste data safety. | |
| 13 | * | |
| 14 | * ## Basic Usage | |
| 15 | * | |
| 16 | * Use ghostty_paste_is_safe() to check if paste data contains potentially | |
| 17 | * dangerous sequences before sending it to the terminal. | |
| 18 | * | |
| 19 | * ## Example | |
| 20 | * | |
| 21 | * @code{.c} | |
| 22 | * #include <stdio.h> | |
| 23 | * #include <string.h> | |
| 24 | * #include <ghostty/vt.h> | |
| 25 | * | |
| 26 | * int main() { | |
| 27 | * const char* safe_data = "hello world"; | |
| 28 | * const char* unsafe_data = "rm -rf /\n"; | |
| 29 | * | |
| 30 | * if (ghostty_paste_is_safe(safe_data, strlen(safe_data))) { | |
| 31 | * printf("Safe to paste\n"); | |
| 32 | * } | |
| 33 | * | |
| 34 | * if (!ghostty_paste_is_safe(unsafe_data, strlen(unsafe_data))) { | |
| 35 | * printf("Unsafe! Contains newline\n"); | |
| 36 | * } | |
| 37 | * | |
| 38 | * return 0; | |
| 39 | * } | |
| 40 | * @endcode | |
| 41 | * | |
| 42 | * @{ | |
| 43 | */ | |
| 44 | ||
| 45 | #include <stdbool.h> | |
| 46 | #include <stddef.h> | |
| 47 | ||
| 48 | #ifdef __cplusplus | |
| 49 | extern "C" { | |
| 50 | #endif | |
| 51 | ||
| 52 | /** | |
| 53 | * Check if paste data is safe to paste into the terminal. | |
| 54 | * | |
| 55 | * Data is considered unsafe if it contains: | |
| 56 | * - Newlines (`\n`) which can inject commands | |
| 57 | * - The bracketed paste end sequence (`\x1b[201~`) which can be used | |
| 58 | * to exit bracketed paste mode and inject commands | |
| 59 | * | |
| 60 | * This check is conservative and considers data unsafe regardless of | |
| 61 | * current terminal state. | |
| 62 | * | |
| 63 | * @param data The paste data to check (must not be NULL) | |
| 64 | * @param len The length of the data in bytes | |
| 65 | * @return true if the data is safe to paste, false otherwise | |
| 66 | */ | |
| 67 | bool ghostty_paste_is_safe(const char* data, size_t len); | |
| 68 | ||
| 69 | #ifdef __cplusplus | |
| 70 | } | |
| 71 | #endif | |
| 72 | ||
| 73 | /** @} */ | |
| 74 | ||
| 75 | #endif /* GHOSTTY_VT_PASTE_H */ |
apps/mobile/modules/t3-terminal/Vendor/libghostty/GhosttyKit.xcframework/ios-arm64-simulator/Headers/ghostty/vt/result.h deleted-22| ... | ... | @@ -1,22 +0,0 @@ |
| 1 | /** | |
| 2 | * @file result.h | |
| 3 | * | |
| 4 | * Result codes for libghostty-vt operations. | |
| 5 | */ | |
| 6 | ||
| 7 | #ifndef GHOSTTY_VT_RESULT_H | |
| 8 | #define GHOSTTY_VT_RESULT_H | |
| 9 | ||
| 10 | /** | |
| 11 | * Result codes for libghostty-vt operations. | |
| 12 | */ | |
| 13 | typedef enum { | |
| 14 | /** Operation completed successfully */ | |
| 15 | GHOSTTY_SUCCESS = 0, | |
| 16 | /** Operation failed due to failed allocation */ | |
| 17 | GHOSTTY_OUT_OF_MEMORY = -1, | |
| 18 | /** Operation failed due to invalid value */ | |
| 19 | GHOSTTY_INVALID_VALUE = -2, | |
| 20 | } GhosttyResult; | |
| 21 | ||
| 22 | #endif /* GHOSTTY_VT_RESULT_H */ |
apps/mobile/modules/t3-terminal/Vendor/libghostty/GhosttyKit.xcframework/ios-arm64-simulator/Headers/ghostty/vt/sgr.h deleted-394| ... | ... | @@ -1,394 +0,0 @@ |
| 1 | /** | |
| 2 | * @file sgr.h | |
| 3 | * | |
| 4 | * SGR (Select Graphic Rendition) attribute parsing and handling. | |
| 5 | */ | |
| 6 | ||
| 7 | #ifndef GHOSTTY_VT_SGR_H | |
| 8 | #define GHOSTTY_VT_SGR_H | |
| 9 | ||
| 10 | /** @defgroup sgr SGR Parser | |
| 11 | * | |
| 12 | * SGR (Select Graphic Rendition) attribute parser. | |
| 13 | * | |
| 14 | * SGR sequences are the syntax used to set styling attributes such as | |
| 15 | * bold, italic, underline, and colors for text in terminal emulators. | |
| 16 | * For example, you may be familiar with sequences like `ESC[1;31m`. The | |
| 17 | * `1;31` is the SGR attribute list. | |
| 18 | * | |
| 19 | * The parser processes SGR parameters from CSI sequences (e.g., `ESC[1;31m`) | |
| 20 | * and returns individual text attributes like bold, italic, colors, etc. | |
| 21 | * It supports both semicolon (`;`) and colon (`:`) separators, possibly mixed, | |
| 22 | * and handles various color formats including 8-color, 16-color, 256-color, | |
| 23 | * X11 named colors, and RGB in multiple formats. | |
| 24 | * | |
| 25 | * ## Basic Usage | |
| 26 | * | |
| 27 | * 1. Create a parser instance with ghostty_sgr_new() | |
| 28 | * 2. Set SGR parameters with ghostty_sgr_set_params() | |
| 29 | * 3. Iterate through attributes using ghostty_sgr_next() | |
| 30 | * 4. Free the parser with ghostty_sgr_free() when done | |
| 31 | * | |
| 32 | * ## Example | |
| 33 | * | |
| 34 | * @code{.c} | |
| 35 | * #include <assert.h> | |
| 36 | * #include <stdio.h> | |
| 37 | * #include <ghostty/vt.h> | |
| 38 | * | |
| 39 | * int main() { | |
| 40 | * // Create parser | |
| 41 | * GhosttySgrParser parser; | |
| 42 | * GhosttyResult result = ghostty_sgr_new(NULL, &parser); | |
| 43 | * assert(result == GHOSTTY_SUCCESS); | |
| 44 | * | |
| 45 | * // Parse "bold, red foreground" sequence: ESC[1;31m | |
| 46 | * uint16_t params[] = {1, 31}; | |
| 47 | * result = ghostty_sgr_set_params(parser, params, NULL, 2); | |
| 48 | * assert(result == GHOSTTY_SUCCESS); | |
| 49 | * | |
| 50 | * // Iterate through attributes | |
| 51 | * GhosttySgrAttribute attr; | |
| 52 | * while (ghostty_sgr_next(parser, &attr)) { | |
| 53 | * switch (attr.tag) { | |
| 54 | * case GHOSTTY_SGR_ATTR_BOLD: | |
| 55 | * printf("Bold enabled\n"); | |
| 56 | * break; | |
| 57 | * case GHOSTTY_SGR_ATTR_FG_8: | |
| 58 | * printf("Foreground color: %d\n", attr.value.fg_8); | |
| 59 | * break; | |
| 60 | * default: | |
| 61 | * break; | |
| 62 | * } | |
| 63 | * } | |
| 64 | * | |
| 65 | * // Cleanup | |
| 66 | * ghostty_sgr_free(parser); | |
| 67 | * return 0; | |
| 68 | * } | |
| 69 | * @endcode | |
| 70 | * | |
| 71 | * @{ | |
| 72 | */ | |
| 73 | ||
| 74 | #include <ghostty/vt/allocator.h> | |
| 75 | #include <ghostty/vt/color.h> | |
| 76 | #include <ghostty/vt/result.h> | |
| 77 | #include <stdbool.h> | |
| 78 | #include <stddef.h> | |
| 79 | #include <stdint.h> | |
| 80 | ||
| 81 | #ifdef __cplusplus | |
| 82 | extern "C" { | |
| 83 | #endif | |
| 84 | ||
| 85 | /** | |
| 86 | * Opaque handle to an SGR parser instance. | |
| 87 | * | |
| 88 | * This handle represents an SGR (Select Graphic Rendition) parser that can | |
| 89 | * be used to parse SGR sequences and extract individual text attributes. | |
| 90 | * | |
| 91 | * @ingroup sgr | |
| 92 | */ | |
| 93 | typedef struct GhosttySgrParser* GhosttySgrParser; | |
| 94 | ||
| 95 | /** | |
| 96 | * SGR attribute tags. | |
| 97 | * | |
| 98 | * These values identify the type of an SGR attribute in a tagged union. | |
| 99 | * Use the tag to determine which field in the attribute value union to access. | |
| 100 | * | |
| 101 | * @ingroup sgr | |
| 102 | */ | |
| 103 | typedef enum { | |
| 104 | GHOSTTY_SGR_ATTR_UNSET = 0, | |
| 105 | GHOSTTY_SGR_ATTR_UNKNOWN = 1, | |
| 106 | GHOSTTY_SGR_ATTR_BOLD = 2, | |
| 107 | GHOSTTY_SGR_ATTR_RESET_BOLD = 3, | |
| 108 | GHOSTTY_SGR_ATTR_ITALIC = 4, | |
| 109 | GHOSTTY_SGR_ATTR_RESET_ITALIC = 5, | |
| 110 | GHOSTTY_SGR_ATTR_FAINT = 6, | |
| 111 | GHOSTTY_SGR_ATTR_UNDERLINE = 7, | |
| 112 | GHOSTTY_SGR_ATTR_RESET_UNDERLINE = 8, | |
| 113 | GHOSTTY_SGR_ATTR_UNDERLINE_COLOR = 9, | |
| 114 | GHOSTTY_SGR_ATTR_UNDERLINE_COLOR_256 = 10, | |
| 115 | GHOSTTY_SGR_ATTR_RESET_UNDERLINE_COLOR = 11, | |
| 116 | GHOSTTY_SGR_ATTR_OVERLINE = 12, | |
| 117 | GHOSTTY_SGR_ATTR_RESET_OVERLINE = 13, | |
| 118 | GHOSTTY_SGR_ATTR_BLINK = 14, | |
| 119 | GHOSTTY_SGR_ATTR_RESET_BLINK = 15, | |
| 120 | GHOSTTY_SGR_ATTR_INVERSE = 16, | |
| 121 | GHOSTTY_SGR_ATTR_RESET_INVERSE = 17, | |
| 122 | GHOSTTY_SGR_ATTR_INVISIBLE = 18, | |
| 123 | GHOSTTY_SGR_ATTR_RESET_INVISIBLE = 19, | |
| 124 | GHOSTTY_SGR_ATTR_STRIKETHROUGH = 20, | |
| 125 | GHOSTTY_SGR_ATTR_RESET_STRIKETHROUGH = 21, | |
| 126 | GHOSTTY_SGR_ATTR_DIRECT_COLOR_FG = 22, | |
| 127 | GHOSTTY_SGR_ATTR_DIRECT_COLOR_BG = 23, | |
| 128 | GHOSTTY_SGR_ATTR_BG_8 = 24, | |
| 129 | GHOSTTY_SGR_ATTR_FG_8 = 25, | |
| 130 | GHOSTTY_SGR_ATTR_RESET_FG = 26, | |
| 131 | GHOSTTY_SGR_ATTR_RESET_BG = 27, | |
| 132 | GHOSTTY_SGR_ATTR_BRIGHT_BG_8 = 28, | |
| 133 | GHOSTTY_SGR_ATTR_BRIGHT_FG_8 = 29, | |
| 134 | GHOSTTY_SGR_ATTR_BG_256 = 30, | |
| 135 | GHOSTTY_SGR_ATTR_FG_256 = 31, | |
| 136 | } GhosttySgrAttributeTag; | |
| 137 | ||
| 138 | /** | |
| 139 | * Underline style types. | |
| 140 | * | |
| 141 | * @ingroup sgr | |
| 142 | */ | |
| 143 | typedef enum { | |
| 144 | GHOSTTY_SGR_UNDERLINE_NONE = 0, | |
| 145 | GHOSTTY_SGR_UNDERLINE_SINGLE = 1, | |
| 146 | GHOSTTY_SGR_UNDERLINE_DOUBLE = 2, | |
| 147 | GHOSTTY_SGR_UNDERLINE_CURLY = 3, | |
| 148 | GHOSTTY_SGR_UNDERLINE_DOTTED = 4, | |
| 149 | GHOSTTY_SGR_UNDERLINE_DASHED = 5, | |
| 150 | } GhosttySgrUnderline; | |
| 151 | ||
| 152 | /** | |
| 153 | * Unknown SGR attribute data. | |
| 154 | * | |
| 155 | * Contains the full parameter list and the partial list where parsing | |
| 156 | * encountered an unknown or invalid sequence. | |
| 157 | * | |
| 158 | * @ingroup sgr | |
| 159 | */ | |
| 160 | typedef struct { | |
| 161 | const uint16_t* full_ptr; | |
| 162 | size_t full_len; | |
| 163 | const uint16_t* partial_ptr; | |
| 164 | size_t partial_len; | |
| 165 | } GhosttySgrUnknown; | |
| 166 | ||
| 167 | /** | |
| 168 | * SGR attribute value union. | |
| 169 | * | |
| 170 | * This union contains all possible attribute values. Use the tag field | |
| 171 | * to determine which union member is active. Attributes without associated | |
| 172 | * data (like bold, italic) don't use the union value. | |
| 173 | * | |
| 174 | * @ingroup sgr | |
| 175 | */ | |
| 176 | typedef union { | |
| 177 | GhosttySgrUnknown unknown; | |
| 178 | GhosttySgrUnderline underline; | |
| 179 | GhosttyColorRgb underline_color; | |
| 180 | GhosttyColorPaletteIndex underline_color_256; | |
| 181 | GhosttyColorRgb direct_color_fg; | |
| 182 | GhosttyColorRgb direct_color_bg; | |
| 183 | GhosttyColorPaletteIndex bg_8; | |
| 184 | GhosttyColorPaletteIndex fg_8; | |
| 185 | GhosttyColorPaletteIndex bright_bg_8; | |
| 186 | GhosttyColorPaletteIndex bright_fg_8; | |
| 187 | GhosttyColorPaletteIndex bg_256; | |
| 188 | GhosttyColorPaletteIndex fg_256; | |
| 189 | uint64_t _padding[8]; | |
| 190 | } GhosttySgrAttributeValue; | |
| 191 | ||
| 192 | /** | |
| 193 | * SGR attribute (tagged union). | |
| 194 | * | |
| 195 | * A complete SGR attribute with both its type tag and associated value. | |
| 196 | * Always check the tag field to determine which value union member is valid. | |
| 197 | * | |
| 198 | * Attributes without associated data (e.g., GHOSTTY_SGR_ATTR_BOLD) can be | |
| 199 | * identified by tag alone; the value union is not used for these and | |
| 200 | * the memory in the value field is undefined. | |
| 201 | * | |
| 202 | * @ingroup sgr | |
| 203 | */ | |
| 204 | typedef struct { | |
| 205 | GhosttySgrAttributeTag tag; | |
| 206 | GhosttySgrAttributeValue value; | |
| 207 | } GhosttySgrAttribute; | |
| 208 | ||
| 209 | /** | |
| 210 | * Create a new SGR parser instance. | |
| 211 | * | |
| 212 | * Creates a new SGR (Select Graphic Rendition) parser using the provided | |
| 213 | * allocator. The parser must be freed using ghostty_sgr_free() when | |
| 214 | * no longer needed. | |
| 215 | * | |
| 216 | * @param allocator Pointer to the allocator to use for memory management, or | |
| 217 | * NULL to use the default allocator | |
| 218 | * @param parser Pointer to store the created parser handle | |
| 219 | * @return GHOSTTY_SUCCESS on success, or an error code on failure | |
| 220 | * | |
| 221 | * @ingroup sgr | |
| 222 | */ | |
| 223 | GhosttyResult ghostty_sgr_new(const GhosttyAllocator* allocator, | |
| 224 | GhosttySgrParser* parser); | |
| 225 | ||
| 226 | /** | |
| 227 | * Free an SGR parser instance. | |
| 228 | * | |
| 229 | * Releases all resources associated with the SGR parser. After this call, | |
| 230 | * the parser handle becomes invalid and must not be used. This includes | |
| 231 | * any attributes previously returned by ghostty_sgr_next(). | |
| 232 | * | |
| 233 | * @param parser The parser handle to free (may be NULL) | |
| 234 | * | |
| 235 | * @ingroup sgr | |
| 236 | */ | |
| 237 | void ghostty_sgr_free(GhosttySgrParser parser); | |
| 238 | ||
| 239 | /** | |
| 240 | * Reset an SGR parser instance to the beginning of the parameter list. | |
| 241 | * | |
| 242 | * Resets the parser's iteration state without clearing the parameters. | |
| 243 | * After calling this, ghostty_sgr_next() will start from the beginning | |
| 244 | * of the parameter list again. | |
| 245 | * | |
| 246 | * @param parser The parser handle to reset, must not be NULL | |
| 247 | * | |
| 248 | * @ingroup sgr | |
| 249 | */ | |
| 250 | void ghostty_sgr_reset(GhosttySgrParser parser); | |
| 251 | ||
| 252 | /** | |
| 253 | * Set SGR parameters for parsing. | |
| 254 | * | |
| 255 | * Sets the SGR parameter list to parse. Parameters are the numeric values | |
| 256 | * from a CSI SGR sequence (e.g., for `ESC[1;31m`, params would be {1, 31}). | |
| 257 | * | |
| 258 | * The separators array optionally specifies the separator type for each | |
| 259 | * parameter position. Each byte should be either ';' for semicolon or ':' | |
| 260 | * for colon. This is needed for certain color formats that use colon | |
| 261 | * separators (e.g., `ESC[4:3m` for curly underline). Any invalid separator | |
| 262 | * values are treated as semicolons. The separators array must have the same | |
| 263 | * length as the params array, if it is not NULL. | |
| 264 | * | |
| 265 | * If separators is NULL, all parameters are assumed to be semicolon-separated. | |
| 266 | * | |
| 267 | * This function makes an internal copy of the parameter and separator data, | |
| 268 | * so the caller can safely free or modify the input arrays after this call. | |
| 269 | * | |
| 270 | * After calling this function, the parser is automatically reset and ready | |
| 271 | * to iterate from the beginning. | |
| 272 | * | |
| 273 | * @param parser The parser handle, must not be NULL | |
| 274 | * @param params Array of SGR parameter values | |
| 275 | * @param separators Optional array of separator characters (';' or ':'), or | |
| 276 | * NULL | |
| 277 | * @param len Number of parameters (and separators if provided) | |
| 278 | * @return GHOSTTY_SUCCESS on success, or an error code on failure | |
| 279 | * | |
| 280 | * @ingroup sgr | |
| 281 | */ | |
| 282 | GhosttyResult ghostty_sgr_set_params(GhosttySgrParser parser, | |
| 283 | const uint16_t* params, | |
| 284 | const char* separators, | |
| 285 | size_t len); | |
| 286 | ||
| 287 | /** | |
| 288 | * Get the next SGR attribute. | |
| 289 | * | |
| 290 | * Parses and returns the next attribute from the parameter list. | |
| 291 | * Call this function repeatedly until it returns false to process | |
| 292 | * all attributes in the sequence. | |
| 293 | * | |
| 294 | * @param parser The parser handle, must not be NULL | |
| 295 | * @param attr Pointer to store the next attribute | |
| 296 | * @return true if an attribute was returned, false if no more attributes | |
| 297 | * | |
| 298 | * @ingroup sgr | |
| 299 | */ | |
| 300 | bool ghostty_sgr_next(GhosttySgrParser parser, GhosttySgrAttribute* attr); | |
| 301 | ||
| 302 | /** | |
| 303 | * Get the full parameter list from an unknown SGR attribute. | |
| 304 | * | |
| 305 | * This function retrieves the full parameter list that was provided to the | |
| 306 | * parser when an unknown attribute was encountered. Primarily useful in | |
| 307 | * WebAssembly environments where accessing struct fields directly is difficult. | |
| 308 | * | |
| 309 | * @param unknown The unknown attribute data | |
| 310 | * @param ptr Pointer to store the pointer to the parameter array (may be NULL) | |
| 311 | * @return The length of the full parameter array | |
| 312 | * | |
| 313 | * @ingroup sgr | |
| 314 | */ | |
| 315 | size_t ghostty_sgr_unknown_full(GhosttySgrUnknown unknown, | |
| 316 | const uint16_t** ptr); | |
| 317 | ||
| 318 | /** | |
| 319 | * Get the partial parameter list from an unknown SGR attribute. | |
| 320 | * | |
| 321 | * This function retrieves the partial parameter list where parsing stopped | |
| 322 | * when an unknown attribute was encountered. Primarily useful in WebAssembly | |
| 323 | * environments where accessing struct fields directly is difficult. | |
| 324 | * | |
| 325 | * @param unknown The unknown attribute data | |
| 326 | * @param ptr Pointer to store the pointer to the parameter array (may be NULL) | |
| 327 | * @return The length of the partial parameter array | |
| 328 | * | |
| 329 | * @ingroup sgr | |
| 330 | */ | |
| 331 | size_t ghostty_sgr_unknown_partial(GhosttySgrUnknown unknown, | |
| 332 | const uint16_t** ptr); | |
| 333 | ||
| 334 | /** | |
| 335 | * Get the tag from an SGR attribute. | |
| 336 | * | |
| 337 | * This function extracts the tag that identifies which type of attribute | |
| 338 | * this is. Primarily useful in WebAssembly environments where accessing | |
| 339 | * struct fields directly is difficult. | |
| 340 | * | |
| 341 | * @param attr The SGR attribute | |
| 342 | * @return The attribute tag | |
| 343 | * | |
| 344 | * @ingroup sgr | |
| 345 | */ | |
| 346 | GhosttySgrAttributeTag ghostty_sgr_attribute_tag(GhosttySgrAttribute attr); | |
| 347 | ||
| 348 | /** | |
| 349 | * Get the value from an SGR attribute. | |
| 350 | * | |
| 351 | * This function returns a pointer to the value union from an SGR attribute. Use | |
| 352 | * the tag to determine which field of the union is valid. Primarily useful in | |
| 353 | * WebAssembly environments where accessing struct fields directly is difficult. | |
| 354 | * | |
| 355 | * @param attr Pointer to the SGR attribute | |
| 356 | * @return Pointer to the attribute value union | |
| 357 | * | |
| 358 | * @ingroup sgr | |
| 359 | */ | |
| 360 | GhosttySgrAttributeValue* ghostty_sgr_attribute_value( | |
| 361 | GhosttySgrAttribute* attr); | |
| 362 | ||
| 363 | #ifdef __wasm__ | |
| 364 | /** | |
| 365 | * Allocate memory for an SGR attribute (WebAssembly only). | |
| 366 | * | |
| 367 | * This is a convenience function for WebAssembly environments to allocate | |
| 368 | * memory for an SGR attribute structure that can be passed to ghostty_sgr_next. | |
| 369 | * | |
| 370 | * @return Pointer to the allocated attribute structure | |
| 371 | * | |
| 372 | * @ingroup wasm | |
| 373 | */ | |
| 374 | GhosttySgrAttribute* ghostty_wasm_alloc_sgr_attribute(void); | |
| 375 | ||
| 376 | /** | |
| 377 | * Free memory for an SGR attribute (WebAssembly only). | |
| 378 | * | |
| 379 | * Frees memory allocated by ghostty_wasm_alloc_sgr_attribute. | |
| 380 | * | |
| 381 | * @param attr Pointer to the attribute structure to free | |
| 382 | * | |
| 383 | * @ingroup wasm | |
| 384 | */ | |
| 385 | void ghostty_wasm_free_sgr_attribute(GhosttySgrAttribute* attr); | |
| 386 | #endif | |
| 387 | ||
| 388 | #ifdef __cplusplus | |
| 389 | } | |
| 390 | #endif | |
| 391 | ||
| 392 | /** @} */ | |
| 393 | ||
| 394 | #endif /* GHOSTTY_VT_SGR_H */ |
apps/mobile/modules/t3-terminal/Vendor/libghostty/GhosttyKit.xcframework/ios-arm64-simulator/Headers/ghostty/vt/wasm.h deleted-159| ... | ... | @@ -1,159 +0,0 @@ |
| 1 | /** | |
| 2 | * @file wasm.h | |
| 3 | * | |
| 4 | * WebAssembly utility functions for libghostty-vt. | |
| 5 | */ | |
| 6 | ||
| 7 | #ifndef GHOSTTY_VT_WASM_H | |
| 8 | #define GHOSTTY_VT_WASM_H | |
| 9 | ||
| 10 | #ifdef __wasm__ | |
| 11 | ||
| 12 | #include <stddef.h> | |
| 13 | #include <stdint.h> | |
| 14 | ||
| 15 | /** @defgroup wasm WebAssembly Utilities | |
| 16 | * | |
| 17 | * Convenience functions for allocating various types in WebAssembly builds. | |
| 18 | * **These are only available the libghostty-vt wasm module.** | |
| 19 | * | |
| 20 | * Ghostty relies on pointers to various types for ABI compatibility, and | |
| 21 | * creating those pointers in Wasm can be tedious. These functions provide | |
| 22 | * a purely additive set of utilities that simplify memory management in | |
| 23 | * Wasm environments without changing the core C library API. | |
| 24 | * | |
| 25 | * @note These functions always use the default allocator. If you need | |
| 26 | * custom allocation strategies, you should allocate types manually using | |
| 27 | * your custom allocator. This is a very rare use case in the WebAssembly | |
| 28 | * world so these are optimized for simplicity. | |
| 29 | * | |
| 30 | * ## Example Usage | |
| 31 | * | |
| 32 | * Here's a simple example of using the Wasm utilities with the key encoder: | |
| 33 | * | |
| 34 | * @code | |
| 35 | * const { exports } = wasmInstance; | |
| 36 | * const view = new DataView(wasmMemory.buffer); | |
| 37 | * | |
| 38 | * // Create key encoder | |
| 39 | * const encoderPtr = exports.ghostty_wasm_alloc_opaque(); | |
| 40 | * exports.ghostty_key_encoder_new(null, encoderPtr); | |
| 41 | * const encoder = view.getUint32(encoder, true); | |
| 42 | * | |
| 43 | * // Configure encoder with Kitty protocol flags | |
| 44 | * const flagsPtr = exports.ghostty_wasm_alloc_u8(); | |
| 45 | * view.setUint8(flagsPtr, 0x1F); | |
| 46 | * exports.ghostty_key_encoder_setopt(encoder, 5, flagsPtr); | |
| 47 | * | |
| 48 | * // Allocate output buffer and size pointer | |
| 49 | * const bufferSize = 32; | |
| 50 | * const bufPtr = exports.ghostty_wasm_alloc_u8_array(bufferSize); | |
| 51 | * const writtenPtr = exports.ghostty_wasm_alloc_usize(); | |
| 52 | * | |
| 53 | * // Encode the key event | |
| 54 | * exports.ghostty_key_encoder_encode( | |
| 55 | * encoder, eventPtr, bufPtr, bufferSize, writtenPtr | |
| 56 | * ); | |
| 57 | * | |
| 58 | * // Read encoded output | |
| 59 | * const bytesWritten = view.getUint32(writtenPtr, true); | |
| 60 | * const encoded = new Uint8Array(wasmMemory.buffer, bufPtr, bytesWritten); | |
| 61 | * @endcode | |
| 62 | * | |
| 63 | * @remark The code above is pretty ugly! This is the lowest level interface | |
| 64 | * to the libghostty-vt Wasm module. In practice, this should be wrapped | |
| 65 | * in a higher-level API that abstracts away all this. | |
| 66 | * | |
| 67 | * @{ | |
| 68 | */ | |
| 69 | ||
| 70 | /** | |
| 71 | * Allocate an opaque pointer. This can be used for any opaque pointer | |
| 72 | * types such as GhosttyKeyEncoder, GhosttyKeyEvent, etc. | |
| 73 | * | |
| 74 | * @return Pointer to allocated opaque pointer, or NULL if allocation failed | |
| 75 | * @ingroup wasm | |
| 76 | */ | |
| 77 | void** ghostty_wasm_alloc_opaque(void); | |
| 78 | ||
| 79 | /** | |
| 80 | * Free an opaque pointer allocated by ghostty_wasm_alloc_opaque(). | |
| 81 | * | |
| 82 | * @param ptr Pointer to free, or NULL (NULL is safely ignored) | |
| 83 | * @ingroup wasm | |
| 84 | */ | |
| 85 | void ghostty_wasm_free_opaque(void **ptr); | |
| 86 | ||
| 87 | /** | |
| 88 | * Allocate an array of uint8_t values. | |
| 89 | * | |
| 90 | * @param len Number of uint8_t elements to allocate | |
| 91 | * @return Pointer to allocated array, or NULL if allocation failed | |
| 92 | * @ingroup wasm | |
| 93 | */ | |
| 94 | uint8_t* ghostty_wasm_alloc_u8_array(size_t len); | |
| 95 | ||
| 96 | /** | |
| 97 | * Free an array allocated by ghostty_wasm_alloc_u8_array(). | |
| 98 | * | |
| 99 | * @param ptr Pointer to the array to free, or NULL (NULL is safely ignored) | |
| 100 | * @param len Length of the array (must match the length passed to alloc) | |
| 101 | * @ingroup wasm | |
| 102 | */ | |
| 103 | void ghostty_wasm_free_u8_array(uint8_t *ptr, size_t len); | |
| 104 | ||
| 105 | /** | |
| 106 | * Allocate an array of uint16_t values. | |
| 107 | * | |
| 108 | * @param len Number of uint16_t elements to allocate | |
| 109 | * @return Pointer to allocated array, or NULL if allocation failed | |
| 110 | * @ingroup wasm | |
| 111 | */ | |
| 112 | uint16_t* ghostty_wasm_alloc_u16_array(size_t len); | |
| 113 | ||
| 114 | /** | |
| 115 | * Free an array allocated by ghostty_wasm_alloc_u16_array(). | |
| 116 | * | |
| 117 | * @param ptr Pointer to the array to free, or NULL (NULL is safely ignored) | |
| 118 | * @param len Length of the array (must match the length passed to alloc) | |
| 119 | * @ingroup wasm | |
| 120 | */ | |
| 121 | void ghostty_wasm_free_u16_array(uint16_t *ptr, size_t len); | |
| 122 | ||
| 123 | /** | |
| 124 | * Allocate a single uint8_t value. | |
| 125 | * | |
| 126 | * @return Pointer to allocated uint8_t, or NULL if allocation failed | |
| 127 | * @ingroup wasm | |
| 128 | */ | |
| 129 | uint8_t* ghostty_wasm_alloc_u8(void); | |
| 130 | ||
| 131 | /** | |
| 132 | * Free a uint8_t allocated by ghostty_wasm_alloc_u8(). | |
| 133 | * | |
| 134 | * @param ptr Pointer to free, or NULL (NULL is safely ignored) | |
| 135 | * @ingroup wasm | |
| 136 | */ | |
| 137 | void ghostty_wasm_free_u8(uint8_t *ptr); | |
| 138 | ||
| 139 | /** | |
| 140 | * Allocate a single size_t value. | |
| 141 | * | |
| 142 | * @return Pointer to allocated size_t, or NULL if allocation failed | |
| 143 | * @ingroup wasm | |
| 144 | */ | |
| 145 | size_t* ghostty_wasm_alloc_usize(void); | |
| 146 | ||
| 147 | /** | |
| 148 | * Free a size_t allocated by ghostty_wasm_alloc_usize(). | |
| 149 | * | |
| 150 | * @param ptr Pointer to free, or NULL (NULL is safely ignored) | |
| 151 | * @ingroup wasm | |
| 152 | */ | |
| 153 | void ghostty_wasm_free_usize(size_t *ptr); | |
| 154 | ||
| 155 | /** @} */ | |
| 156 | ||
| 157 | #endif /* __wasm__ */ | |
| 158 | ||
| 159 | #endif /* GHOSTTY_VT_WASM_H */ |
apps/mobile/modules/t3-terminal/Vendor/libghostty/GhosttyKit.xcframework/ios-arm64-simulator/libghostty-fat.a| Binary files a/apps/mobile/modules/t3-terminal/Vendor/libghostty/GhosttyKit.xcframework/ios-arm64-simulator/libghostty-fat.a and b/apps/mobile/modules/t3-terminal/Vendor/libghostty/GhosttyKit.xcframework/ios-arm64-simulator/libghostty-fat.a differ |
apps/mobile/modules/t3-terminal/Vendor/libghostty/GhosttyKit.xcframework/ios-arm64/Headers/ghostty.h+92-20| ... | ... | @@ -1,10 +1,14 @@ |
| 1 | // Ghostty embedding API. The documentation for the embedding API is | |
| 2 | // only within the Zig source files that define the implementations. This | |
| 3 | // isn't meant to be a general purpose embedding API (yet) so there hasn't | |
| 4 | // been documentation or example work beyond that. | |
| 1 | // Ghostty's internal embedder API, a.k.a. "libghostty-internal". | |
| 5 | 2 | // |
| 6 | // The only consumer of this API is the macOS app, but the API is built to | |
| 7 | // be more general purpose. | |
| 3 | // The only consumer of this API is the macOS app, and while it is fairly | |
| 4 | // comprehensive, it is tailored to the needs of the macOS app and not designed | |
| 5 | // for external use, hence why most functions are undocumented and some are | |
| 6 | // macOS-specific (e.g. ones dealing with the Metal graphics API). | |
| 7 | // | |
| 8 | // External embedders should instead use `libghostty-vt` or other related | |
| 9 | // packages, which are extensively documented and designed from the ground up | |
| 10 | // to be used in other software. Header files for which can be found in | |
| 11 | // `include/ghostty/`. | |
| 8 | 12 | #ifndef GHOSTTY_H |
| 9 | 13 | #define GHOSTTY_H |
| 10 | 14 | |
| ... | ... | @@ -68,7 +72,7 @@ typedef enum { |
| 68 | 72 | GHOSTTY_PLATFORM_IOS, |
| 69 | 73 | } ghostty_platform_e; |
| 70 | 74 | |
| 71 | // Callback for custom I/O write handler. | |
| 75 | // Callback for custom surface I/O writes. | |
| 72 | 76 | typedef void (*ghostty_surface_write_fn)(void* userdata, |
| 73 | 77 | const uint8_t* data, |
| 74 | 78 | size_t len); |
| ... | ... | @@ -76,19 +80,56 @@ typedef void (*ghostty_surface_write_fn)(void* userdata, |
| 76 | 80 | typedef enum { |
| 77 | 81 | GHOSTTY_CLIPBOARD_STANDARD, |
| 78 | 82 | GHOSTTY_CLIPBOARD_SELECTION, |
| 83 | GHOSTTY_CLIPBOARD_PRIMARY, | |
| 79 | 84 | } ghostty_clipboard_e; |
| 80 | 85 | |
| 86 | // One representation of clipboard contents. The data is binary-safe with | |
| 87 | // an explicit length; it is not necessarily null-terminated. | |
| 81 | 88 | typedef struct { |
| 82 | 89 | const char *mime; |
| 83 | 90 | const char *data; |
| 91 | size_t len; | |
| 84 | 92 | } ghostty_clipboard_content_s; |
| 85 | 93 | |
| 94 | // The payload for completing a clipboard read request. See | |
| 95 | // ghostty_surface_complete_clipboard_request. | |
| 96 | typedef struct { | |
| 97 | const ghostty_clipboard_content_s *contents; | |
| 98 | size_t contents_len; | |
| 99 | const char *const *available; | |
| 100 | size_t available_len; | |
| 101 | bool confirmed; | |
| 102 | bool remember; | |
| 103 | } ghostty_clipboard_complete_s; | |
| 104 | ||
| 105 | // The payload of a clipboard read confirmation request: the would-be | |
| 106 | // completion contents plus the information shown in the permission | |
| 107 | // prompt. See ghostty_runtime_confirm_read_clipboard_cb. | |
| 108 | typedef struct { | |
| 109 | const ghostty_clipboard_content_s *contents; | |
| 110 | size_t contents_len; | |
| 111 | const char *const *available; | |
| 112 | size_t available_len; | |
| 113 | const char *name; | |
| 114 | bool can_remember; | |
| 115 | } ghostty_clipboard_confirm_s; | |
| 116 | ||
| 86 | 117 | typedef enum { |
| 87 | 118 | GHOSTTY_CLIPBOARD_REQUEST_PASTE, |
| 88 | 119 | GHOSTTY_CLIPBOARD_REQUEST_OSC_52_READ, |
| 89 | 120 | GHOSTTY_CLIPBOARD_REQUEST_OSC_52_WRITE, |
| 121 | GHOSTTY_CLIPBOARD_REQUEST_KITTY_READ, | |
| 122 | GHOSTTY_CLIPBOARD_REQUEST_KITTY_WRITE, | |
| 123 | GHOSTTY_CLIPBOARD_REQUEST_LIST, | |
| 90 | 124 | } ghostty_clipboard_request_e; |
| 91 | 125 | |
| 126 | // apprt.ClipboardReadResult | |
| 127 | typedef enum { | |
| 128 | GHOSTTY_CLIPBOARD_READ_STARTED, | |
| 129 | GHOSTTY_CLIPBOARD_READ_UNAVAILABLE, | |
| 130 | GHOSTTY_CLIPBOARD_READ_UNSUPPORTED, | |
| 131 | } ghostty_clipboard_read_result_e; | |
| 132 | ||
| 92 | 133 | typedef enum { |
| 93 | 134 | GHOSTTY_MOUSE_RELEASE, |
| 94 | 135 | GHOSTTY_MOUSE_PRESS, |
| ... | ... | @@ -369,7 +410,6 @@ typedef enum { |
| 369 | 410 | } ghostty_input_trigger_tag_e; |
| 370 | 411 | |
| 371 | 412 | typedef union { |
| 372 | ghostty_input_key_e translated; | |
| 373 | 413 | ghostty_input_key_e physical; |
| 374 | 414 | uint32_t unicode; |
| 375 | 415 | // catch_all has no payload |
| ... | ... | @@ -652,6 +692,12 @@ typedef enum { |
| 652 | 692 | GHOSTTY_INSPECTOR_HIDE, |
| 653 | 693 | } ghostty_action_inspector_e; |
| 654 | 694 | |
| 695 | // apprt.action.ExportTerminalIO.C | |
| 696 | typedef struct { | |
| 697 | const char* contents; | |
| 698 | size_t len; | |
| 699 | } ghostty_action_export_terminal_io_s; | |
| 700 | ||
| 655 | 701 | // apprt.action.QuitTimer |
| 656 | 702 | typedef enum { |
| 657 | 703 | GHOSTTY_QUIT_TIMER_START, |
| ... | ... | @@ -679,6 +725,7 @@ typedef struct { |
| 679 | 725 | typedef enum { |
| 680 | 726 | GHOSTTY_PROMPT_TITLE_SURFACE, |
| 681 | 727 | GHOSTTY_PROMPT_TITLE_TAB, |
| 728 | GHOSTTY_PROMPT_TITLE_WINDOW, | |
| 682 | 729 | } ghostty_action_prompt_title_e; |
| 683 | 730 | |
| 684 | 731 | // apprt.action.Pwd.C |
| ... | ... | @@ -686,6 +733,14 @@ typedef struct { |
| 686 | 733 | const char* pwd; |
| 687 | 734 | } ghostty_action_pwd_s; |
| 688 | 735 | |
| 736 | // apprt.action.OpenConfig | |
| 737 | typedef enum { | |
| 738 | // Open the config in the OS default editor. | |
| 739 | GHOSTTY_ACTION_OPEN_CONFIG_OS_OPEN, | |
| 740 | // Open the config in a new window using $EDITOR or $VISUAL | |
| 741 | GHOSTTY_ACTION_OPEN_CONFIG_NEW_WINDOW, | |
| 742 | } ghostty_action_open_config_e; | |
| 743 | ||
| 689 | 744 | // terminal.MouseShape |
| 690 | 745 | typedef enum { |
| 691 | 746 | GHOSTTY_MOUSE_SHAPE_DEFAULT, |
| ... | ... | @@ -819,6 +874,7 @@ typedef enum { |
| 819 | 874 | GHOSTTY_ACTION_OPEN_URL_KIND_UNKNOWN, |
| 820 | 875 | GHOSTTY_ACTION_OPEN_URL_KIND_TEXT, |
| 821 | 876 | GHOSTTY_ACTION_OPEN_URL_KIND_HTML, |
| 877 | GHOSTTY_ACTION_OPEN_URL_KIND_OSC8, | |
| 822 | 878 | } ghostty_action_open_url_kind_e; |
| 823 | 879 | |
| 824 | 880 | // apprt.action.OpenUrl.C |
| ... | ... | @@ -921,9 +977,11 @@ typedef enum { |
| 921 | 977 | GHOSTTY_ACTION_INSPECTOR, |
| 922 | 978 | GHOSTTY_ACTION_SHOW_GTK_INSPECTOR, |
| 923 | 979 | GHOSTTY_ACTION_RENDER_INSPECTOR, |
| 980 | GHOSTTY_ACTION_EXPORT_TERMINAL_IO, | |
| 924 | 981 | GHOSTTY_ACTION_DESKTOP_NOTIFICATION, |
| 925 | 982 | GHOSTTY_ACTION_SET_TITLE, |
| 926 | 983 | GHOSTTY_ACTION_SET_TAB_TITLE, |
| 984 | GHOSTTY_ACTION_SET_WINDOW_TITLE, | |
| 927 | 985 | GHOSTTY_ACTION_PROMPT_TITLE, |
| 928 | 986 | GHOSTTY_ACTION_PWD, |
| 929 | 987 | GHOSTTY_ACTION_MOUSE_SHAPE, |
| ... | ... | @@ -941,6 +999,7 @@ typedef enum { |
| 941 | 999 | GHOSTTY_ACTION_CONFIG_CHANGE, |
| 942 | 1000 | GHOSTTY_ACTION_CLOSE_WINDOW, |
| 943 | 1001 | GHOSTTY_ACTION_RING_BELL, |
| 1002 | GHOSTTY_ACTION_SELECTION_CHANGED, | |
| 944 | 1003 | GHOSTTY_ACTION_UNDO, |
| 945 | 1004 | GHOSTTY_ACTION_REDO, |
| 946 | 1005 | GHOSTTY_ACTION_CHECK_FOR_UPDATES, |
| ... | ... | @@ -955,6 +1014,7 @@ typedef enum { |
| 955 | 1014 | GHOSTTY_ACTION_SEARCH_SELECTED, |
| 956 | 1015 | GHOSTTY_ACTION_READONLY, |
| 957 | 1016 | GHOSTTY_ACTION_COPY_TITLE_TO_CLIPBOARD, |
| 1017 | GHOSTTY_ACTION_MOVE_TAB_TO_NEW_WINDOW, | |
| 958 | 1018 | } ghostty_action_tag_e; |
| 959 | 1019 | |
| 960 | 1020 | typedef union { |
| ... | ... | @@ -970,6 +1030,7 @@ typedef union { |
| 970 | 1030 | ghostty_action_cell_size_s cell_size; |
| 971 | 1031 | ghostty_action_scrollbar_s scrollbar; |
| 972 | 1032 | ghostty_action_inspector_e inspector; |
| 1033 | ghostty_action_export_terminal_io_s export_terminal_io; | |
| 973 | 1034 | ghostty_action_desktop_notification_s desktop_notification; |
| 974 | 1035 | ghostty_action_set_title_s set_title; |
| 975 | 1036 | ghostty_action_set_title_s set_tab_title; |
| ... | ... | @@ -996,6 +1057,7 @@ typedef union { |
| 996 | 1057 | ghostty_action_search_total_s search_total; |
| 997 | 1058 | ghostty_action_search_selected_s search_selected; |
| 998 | 1059 | ghostty_action_readonly_e readonly; |
| 1060 | ghostty_action_open_config_e open_config; | |
| 999 | 1061 | } ghostty_action_u; |
| 1000 | 1062 | |
| 1001 | 1063 | typedef struct { |
| ... | ... | @@ -1004,12 +1066,16 @@ typedef struct { |
| 1004 | 1066 | } ghostty_action_s; |
| 1005 | 1067 | |
| 1006 | 1068 | typedef void (*ghostty_runtime_wakeup_cb)(void*); |
| 1007 | typedef bool (*ghostty_runtime_read_clipboard_cb)(void*, | |
| 1008 | ghostty_clipboard_e, | |
| 1009 | void*); | |
| 1069 | typedef ghostty_clipboard_read_result_e (*ghostty_runtime_read_clipboard_cb)( | |
| 1070 | void*, | |
| 1071 | ghostty_clipboard_e, | |
| 1072 | void*, | |
| 1073 | const char* const*, | |
| 1074 | size_t, | |
| 1075 | bool); | |
| 1010 | 1076 | typedef void (*ghostty_runtime_confirm_read_clipboard_cb)( |
| 1011 | 1077 | void*, |
| 1012 | const char*, | |
| 1078 | const ghostty_clipboard_confirm_s*, | |
| 1013 | 1079 | void*, |
| 1014 | 1080 | ghostty_clipboard_request_e); |
| 1015 | 1081 | typedef void (*ghostty_runtime_write_clipboard_cb)(void*, |
| ... | ... | @@ -1061,6 +1127,8 @@ typedef union { |
| 1061 | 1127 | // apprt.ipc.Action.Key |
| 1062 | 1128 | typedef enum { |
| 1063 | 1129 | GHOSTTY_IPC_ACTION_NEW_WINDOW, |
| 1130 | GHOSTTY_IPC_ACTION_NEW_TAB, | |
| 1131 | GHOSTTY_IPC_ACTION_TOGGLE_QUICK_TERMINAL, | |
| 1064 | 1132 | } ghostty_ipc_action_tag_e; |
| 1065 | 1133 | |
| 1066 | 1134 | //------------------------------------------------------------------- |
| ... | ... | @@ -1084,6 +1152,7 @@ GHOSTTY_API bool ghostty_config_get(ghostty_config_t, void*, const char*, uintpt |
| 1084 | 1152 | GHOSTTY_API ghostty_input_trigger_s ghostty_config_trigger(ghostty_config_t, |
| 1085 | 1153 | const char*, |
| 1086 | 1154 | uintptr_t); |
| 1155 | GHOSTTY_API bool ghostty_config_key_is_binding(ghostty_config_t, ghostty_input_key_s); | |
| 1087 | 1156 | GHOSTTY_API uint32_t ghostty_config_diagnostics_count(ghostty_config_t); |
| 1088 | 1157 | GHOSTTY_API ghostty_diagnostic_s ghostty_config_get_diagnostic(ghostty_config_t, uint32_t); |
| 1089 | 1158 | GHOSTTY_API ghostty_string_s ghostty_config_open_path(void); |
| ... | ... | @@ -1095,7 +1164,6 @@ GHOSTTY_API void ghostty_app_tick(ghostty_app_t); |
| 1095 | 1164 | GHOSTTY_API void* ghostty_app_userdata(ghostty_app_t); |
| 1096 | 1165 | GHOSTTY_API void ghostty_app_set_focus(ghostty_app_t, bool); |
| 1097 | 1166 | GHOSTTY_API bool ghostty_app_key(ghostty_app_t, ghostty_input_key_s); |
| 1098 | GHOSTTY_API bool ghostty_app_key_is_binding(ghostty_app_t, ghostty_input_key_s); | |
| 1099 | 1167 | GHOSTTY_API void ghostty_app_keyboard_changed(ghostty_app_t); |
| 1100 | 1168 | GHOSTTY_API void ghostty_app_open_config(ghostty_app_t); |
| 1101 | 1169 | GHOSTTY_API void ghostty_app_update_config(ghostty_app_t, ghostty_config_t); |
| ... | ... | @@ -1116,10 +1184,12 @@ GHOSTTY_API bool ghostty_surface_needs_confirm_quit(ghostty_surface_t); |
| 1116 | 1184 | GHOSTTY_API bool ghostty_surface_process_exited(ghostty_surface_t); |
| 1117 | 1185 | GHOSTTY_API void ghostty_surface_refresh(ghostty_surface_t); |
| 1118 | 1186 | GHOSTTY_API void ghostty_surface_draw(ghostty_surface_t); |
| 1119 | GHOSTTY_API void ghostty_surface_feed_data(ghostty_surface_t, const uint8_t*, size_t); | |
| 1187 | GHOSTTY_API void ghostty_surface_feed_data(ghostty_surface_t, | |
| 1188 | const uint8_t*, | |
| 1189 | size_t); | |
| 1120 | 1190 | GHOSTTY_API void ghostty_surface_set_write_callback(ghostty_surface_t, |
| 1121 | ghostty_surface_write_fn, | |
| 1122 | void*); | |
| 1191 | ghostty_surface_write_fn, | |
| 1192 | void*); | |
| 1123 | 1193 | GHOSTTY_API void ghostty_surface_set_content_scale(ghostty_surface_t, double, double); |
| 1124 | 1194 | GHOSTTY_API void ghostty_surface_set_focus(ghostty_surface_t, bool); |
| 1125 | 1195 | GHOSTTY_API void ghostty_surface_set_occlusion(ghostty_surface_t, bool); |
| ... | ... | @@ -1161,10 +1231,12 @@ GHOSTTY_API void ghostty_surface_split_resize(ghostty_surface_t, |
| 1161 | 1231 | uint16_t); |
| 1162 | 1232 | GHOSTTY_API void ghostty_surface_split_equalize(ghostty_surface_t); |
| 1163 | 1233 | GHOSTTY_API bool ghostty_surface_binding_action(ghostty_surface_t, const char*, uintptr_t); |
| 1164 | GHOSTTY_API void ghostty_surface_complete_clipboard_request(ghostty_surface_t, | |
| 1165 | const char*, | |
| 1166 | void*, | |
| 1167 | bool); | |
| 1234 | GHOSTTY_API void ghostty_surface_complete_clipboard_request( | |
| 1235 | ghostty_surface_t, | |
| 1236 | const ghostty_clipboard_complete_s*, | |
| 1237 | void*); | |
| 1238 | GHOSTTY_API void ghostty_surface_deny_clipboard_request(ghostty_surface_t, | |
| 1239 | void*); | |
| 1168 | 1240 | GHOSTTY_API bool ghostty_surface_has_selection(ghostty_surface_t); |
| 1169 | 1241 | GHOSTTY_API bool ghostty_surface_read_selection(ghostty_surface_t, ghostty_text_s*); |
| 1170 | 1242 | GHOSTTY_API bool ghostty_surface_read_text(ghostty_surface_t, |
apps/mobile/modules/t3-terminal/Vendor/libghostty/GhosttyKit.xcframework/ios-arm64/Headers/ghostty/vt.h deleted-87| ... | ... | @@ -1,87 +0,0 @@ |
| 1 | /** | |
| 2 | * @file vt.h | |
| 3 | * | |
| 4 | * libghostty-vt - Virtual terminal emulator library | |
| 5 | * | |
| 6 | * This library provides functionality for parsing and handling terminal | |
| 7 | * escape sequences as well as maintaining terminal state such as styles, | |
| 8 | * cursor position, screen, scrollback, and more. | |
| 9 | * | |
| 10 | * WARNING: This is an incomplete, work-in-progress API. It is not yet | |
| 11 | * stable and is definitely going to change. | |
| 12 | */ | |
| 13 | ||
| 14 | /** | |
| 15 | * @mainpage libghostty-vt - Virtual Terminal Emulator Library | |
| 16 | * | |
| 17 | * libghostty-vt is a C library which implements a modern terminal emulator, | |
| 18 | * extracted from the [Ghostty](https://ghostty.org) terminal emulator. | |
| 19 | * | |
| 20 | * libghostty-vt contains the logic for handling the core parts of a terminal | |
| 21 | * emulator: parsing terminal escape sequences, maintaining terminal state, | |
| 22 | * encoding input events, etc. It can handle scrollback, line wrapping, | |
| 23 | * reflow on resize, and more. | |
| 24 | * | |
| 25 | * @warning This library is currently in development and the API is not yet stable. | |
| 26 | * Breaking changes are expected in future versions. Use with caution in production code. | |
| 27 | * | |
| 28 | * @section groups_sec API Reference | |
| 29 | * | |
| 30 | * The API is organized into the following groups: | |
| 31 | * - @ref key "Key Encoding" - Encode key events into terminal sequences | |
| 32 | * - @ref osc "OSC Parser" - Parse OSC (Operating System Command) sequences | |
| 33 | * - @ref sgr "SGR Parser" - Parse SGR (Select Graphic Rendition) sequences | |
| 34 | * - @ref paste "Paste Utilities" - Validate paste data safety | |
| 35 | * - @ref allocator "Memory Management" - Memory management and custom allocators | |
| 36 | * - @ref wasm "WebAssembly Utilities" - WebAssembly convenience functions | |
| 37 | * | |
| 38 | * @section examples_sec Examples | |
| 39 | * | |
| 40 | * Complete working examples: | |
| 41 | * - @ref c-vt/src/main.c - OSC parser example | |
| 42 | * - @ref c-vt-key-encode/src/main.c - Key encoding example | |
| 43 | * - @ref c-vt-paste/src/main.c - Paste safety check example | |
| 44 | * - @ref c-vt-sgr/src/main.c - SGR parser example | |
| 45 | * | |
| 46 | */ | |
| 47 | ||
| 48 | /** @example c-vt/src/main.c | |
| 49 | * This example demonstrates how to use the OSC parser to parse an OSC sequence, | |
| 50 | * extract command information, and retrieve command-specific data like window titles. | |
| 51 | */ | |
| 52 | ||
| 53 | /** @example c-vt-key-encode/src/main.c | |
| 54 | * This example demonstrates how to use the key encoder to convert key events | |
| 55 | * into terminal escape sequences using the Kitty keyboard protocol. | |
| 56 | */ | |
| 57 | ||
| 58 | /** @example c-vt-paste/src/main.c | |
| 59 | * This example demonstrates how to use the paste utilities to check if | |
| 60 | * paste data is safe before sending it to the terminal. | |
| 61 | */ | |
| 62 | ||
| 63 | /** @example c-vt-sgr/src/main.c | |
| 64 | * This example demonstrates how to use the SGR parser to parse terminal | |
| 65 | * styling sequences and extract text attributes like colors and underline styles. | |
| 66 | */ | |
| 67 | ||
| 68 | #ifndef GHOSTTY_VT_H | |
| 69 | #define GHOSTTY_VT_H | |
| 70 | ||
| 71 | #ifdef __cplusplus | |
| 72 | extern "C" { | |
| 73 | #endif | |
| 74 | ||
| 75 | #include <ghostty/vt/result.h> | |
| 76 | #include <ghostty/vt/allocator.h> | |
| 77 | #include <ghostty/vt/osc.h> | |
| 78 | #include <ghostty/vt/sgr.h> | |
| 79 | #include <ghostty/vt/key.h> | |
| 80 | #include <ghostty/vt/paste.h> | |
| 81 | #include <ghostty/vt/wasm.h> | |
| 82 | ||
| 83 | #ifdef __cplusplus | |
| 84 | } | |
| 85 | #endif | |
| 86 | ||
| 87 | #endif /* GHOSTTY_VT_H */ |
apps/mobile/modules/t3-terminal/Vendor/libghostty/GhosttyKit.xcframework/ios-arm64/Headers/ghostty/vt/allocator.h deleted-196| ... | ... | @@ -1,196 +0,0 @@ |
| 1 | /** | |
| 2 | * @file allocator.h | |
| 3 | * | |
| 4 | * Memory management interface for libghostty-vt. | |
| 5 | */ | |
| 6 | ||
| 7 | #ifndef GHOSTTY_VT_ALLOCATOR_H | |
| 8 | #define GHOSTTY_VT_ALLOCATOR_H | |
| 9 | ||
| 10 | #include <stdbool.h> | |
| 11 | #include <stddef.h> | |
| 12 | #include <stdint.h> | |
| 13 | ||
| 14 | /** @defgroup allocator Memory Management | |
| 15 | * | |
| 16 | * libghostty-vt does require memory allocation for various operations, | |
| 17 | * but is resilient to allocation failures and will gracefully handle | |
| 18 | * out-of-memory situations by returning error codes. | |
| 19 | * | |
| 20 | * The exact memory management semantics are documented in the relevant | |
| 21 | * functions and data structures. | |
| 22 | * | |
| 23 | * libghostty-vt uses explicit memory allocation via an allocator | |
| 24 | * interface provided by GhosttyAllocator. The interface is based on the | |
| 25 | * [Zig](https://ziglang.org) allocator interface, since this has been | |
| 26 | * shown to be a flexible and powerful interface in practice and enables | |
| 27 | * a wide variety of allocation strategies. | |
| 28 | * | |
| 29 | * **For the common case, you can pass NULL as the allocator for any | |
| 30 | * function that accepts one,** and libghostty will use a default allocator. | |
| 31 | * The default allocator will be libc malloc/free if libc is linked. | |
| 32 | * Otherwise, a custom allocator is used (currently Zig's SMP allocator) | |
| 33 | * that doesn't require any external dependencies. | |
| 34 | * | |
| 35 | * ## Basic Usage | |
| 36 | * | |
| 37 | * For simple use cases, you can ignore this interface entirely by passing NULL | |
| 38 | * as the allocator parameter to functions that accept one. This will use the | |
| 39 | * default allocator (typically libc malloc/free, if libc is linked, but | |
| 40 | * we provide our own default allocator if libc isn't linked). | |
| 41 | * | |
| 42 | * To use a custom allocator: | |
| 43 | * 1. Implement the GhosttyAllocatorVtable function pointers | |
| 44 | * 2. Create a GhosttyAllocator struct with your vtable and context | |
| 45 | * 3. Pass the allocator to functions that accept one | |
| 46 | * | |
| 47 | * @{ | |
| 48 | */ | |
| 49 | ||
| 50 | /** | |
| 51 | * Function table for custom memory allocator operations. | |
| 52 | * | |
| 53 | * This vtable defines the interface for a custom memory allocator. All | |
| 54 | * function pointers must be valid and non-NULL. | |
| 55 | * | |
| 56 | * @ingroup allocator | |
| 57 | * | |
| 58 | * If you're not going to use a custom allocator, you can ignore all of | |
| 59 | * this. All functions that take an allocator pointer allow NULL to use a | |
| 60 | * default allocator. | |
| 61 | * | |
| 62 | * The interface is based on the Zig allocator interface. I'll say up front | |
| 63 | * that it is easy to look at this interface and think "wow, this is really | |
| 64 | * overcomplicated". The reason for this complexity is well thought out by | |
| 65 | * the Zig folks, and it enables a diverse set of allocation strategies | |
| 66 | * as shown by the Zig ecosystem. As a consolation, please note that many | |
| 67 | * of the arguments are only needed for advanced use cases and can be | |
| 68 | * safely ignored in simple implementations. For example, if you look at | |
| 69 | * the Zig implementation of the libc allocator in `lib/std/heap.zig` | |
| 70 | * (search for CAllocator), you'll see it is very simple. | |
| 71 | * | |
| 72 | * We chose to align with the Zig allocator interface because: | |
| 73 | * | |
| 74 | * 1. It is a proven interface that serves a wide variety of use cases | |
| 75 | * in the real world via the Zig ecosystem. It's shown to work. | |
| 76 | * | |
| 77 | * 2. Our core implementation itself is Zig, and this lets us very | |
| 78 | * cheaply and easily convert between C and Zig allocators. | |
| 79 | * | |
| 80 | * NOTE(mitchellh): In the future, we can have default implementations of | |
| 81 | * resize/remap and allow those to be null. | |
| 82 | */ | |
| 83 | typedef struct { | |
| 84 | /** | |
| 85 | * Return a pointer to `len` bytes with specified `alignment`, or return | |
| 86 | * `NULL` indicating the allocation failed. | |
| 87 | * | |
| 88 | * @param ctx The allocator context | |
| 89 | * @param len Number of bytes to allocate | |
| 90 | * @param alignment Required alignment for the allocation. Guaranteed to | |
| 91 | * be a power of two between 1 and 16 inclusive. | |
| 92 | * @param ret_addr First return address of the allocation call stack (0 if not provided) | |
| 93 | * @return Pointer to allocated memory, or NULL if allocation failed | |
| 94 | */ | |
| 95 | void* (*alloc)(void *ctx, size_t len, uint8_t alignment, uintptr_t ret_addr); | |
| 96 | ||
| 97 | /** | |
| 98 | * Attempt to expand or shrink memory in place. | |
| 99 | * | |
| 100 | * `memory_len` must equal the length requested from the most recent | |
| 101 | * successful call to `alloc`, `resize`, or `remap`. `alignment` must | |
| 102 | * equal the same value that was passed as the `alignment` parameter to | |
| 103 | * the original `alloc` call. | |
| 104 | * | |
| 105 | * `new_len` must be greater than zero. | |
| 106 | * | |
| 107 | * @param ctx The allocator context | |
| 108 | * @param memory Pointer to the memory block to resize | |
| 109 | * @param memory_len Current size of the memory block | |
| 110 | * @param alignment Alignment (must match original allocation) | |
| 111 | * @param new_len New requested size | |
| 112 | * @param ret_addr First return address of the allocation call stack (0 if not provided) | |
| 113 | * @return true if resize was successful in-place, false if relocation would be required | |
| 114 | */ | |
| 115 | bool (*resize)(void *ctx, void *memory, size_t memory_len, uint8_t alignment, size_t new_len, uintptr_t ret_addr); | |
| 116 | ||
| 117 | /** | |
| 118 | * Attempt to expand or shrink memory, allowing relocation. | |
| 119 | * | |
| 120 | * `memory_len` must equal the length requested from the most recent | |
| 121 | * successful call to `alloc`, `resize`, or `remap`. `alignment` must | |
| 122 | * equal the same value that was passed as the `alignment` parameter to | |
| 123 | * the original `alloc` call. | |
| 124 | * | |
| 125 | * A non-`NULL` return value indicates the resize was successful. The | |
| 126 | * allocation may have same address, or may have been relocated. In either | |
| 127 | * case, the allocation now has size of `new_len`. A `NULL` return value | |
| 128 | * indicates that the resize would be equivalent to allocating new memory, | |
| 129 | * copying the bytes from the old memory, and then freeing the old memory. | |
| 130 | * In such case, it is more efficient for the caller to perform the copy. | |
| 131 | * | |
| 132 | * `new_len` must be greater than zero. | |
| 133 | * | |
| 134 | * @param ctx The allocator context | |
| 135 | * @param memory Pointer to the memory block to remap | |
| 136 | * @param memory_len Current size of the memory block | |
| 137 | * @param alignment Alignment (must match original allocation) | |
| 138 | * @param new_len New requested size | |
| 139 | * @param ret_addr First return address of the allocation call stack (0 if not provided) | |
| 140 | * @return Pointer to resized memory (may be relocated), or NULL if manual copy is needed | |
| 141 | */ | |
| 142 | void* (*remap)(void *ctx, void *memory, size_t memory_len, uint8_t alignment, size_t new_len, uintptr_t ret_addr); | |
| 143 | ||
| 144 | /** | |
| 145 | * Free and invalidate a region of memory. | |
| 146 | * | |
| 147 | * `memory_len` must equal the length requested from the most recent | |
| 148 | * successful call to `alloc`, `resize`, or `remap`. `alignment` must | |
| 149 | * equal the same value that was passed as the `alignment` parameter to | |
| 150 | * the original `alloc` call. | |
| 151 | * | |
| 152 | * @param ctx The allocator context | |
| 153 | * @param memory Pointer to the memory block to free | |
| 154 | * @param memory_len Size of the memory block | |
| 155 | * @param alignment Alignment (must match original allocation) | |
| 156 | * @param ret_addr First return address of the allocation call stack (0 if not provided) | |
| 157 | */ | |
| 158 | void (*free)(void *ctx, void *memory, size_t memory_len, uint8_t alignment, uintptr_t ret_addr); | |
| 159 | } GhosttyAllocatorVtable; | |
| 160 | ||
| 161 | /** | |
| 162 | * Custom memory allocator. | |
| 163 | * | |
| 164 | * For functions that take an allocator pointer, a NULL pointer indicates | |
| 165 | * that the default allocator should be used. The default allocator will | |
| 166 | * be libc malloc/free if we're linking to libc. If libc isn't linked, | |
| 167 | * a custom allocator is used (currently Zig's SMP allocator). | |
| 168 | * | |
| 169 | * @ingroup allocator | |
| 170 | * | |
| 171 | * Usage example: | |
| 172 | * @code | |
| 173 | * GhosttyAllocator allocator = { | |
| 174 | * .vtable = &my_allocator_vtable, | |
| 175 | * .ctx = my_allocator_state | |
| 176 | * }; | |
| 177 | * @endcode | |
| 178 | */ | |
| 179 | typedef struct GhosttyAllocator { | |
| 180 | /** | |
| 181 | * Opaque context pointer passed to all vtable functions. | |
| 182 | * This allows the allocator implementation to maintain state | |
| 183 | * or reference external resources needed for memory management. | |
| 184 | */ | |
| 185 | void *ctx; | |
| 186 | ||
| 187 | /** | |
| 188 | * Pointer to the allocator's vtable containing function pointers | |
| 189 | * for memory operations (alloc, resize, remap, free). | |
| 190 | */ | |
| 191 | const GhosttyAllocatorVtable *vtable; | |
| 192 | } GhosttyAllocator; | |
| 193 | ||
| 194 | /** @} */ | |
| 195 | ||
| 196 | #endif /* GHOSTTY_VT_ALLOCATOR_H */ |
apps/mobile/modules/t3-terminal/Vendor/libghostty/GhosttyKit.xcframework/ios-arm64/Headers/ghostty/vt/color.h deleted-96| ... | ... | @@ -1,96 +0,0 @@ |
| 1 | /** | |
| 2 | * @file color.h | |
| 3 | * | |
| 4 | * Color types and utilities. | |
| 5 | */ | |
| 6 | ||
| 7 | #ifndef GHOSTTY_VT_COLOR_H | |
| 8 | #define GHOSTTY_VT_COLOR_H | |
| 9 | ||
| 10 | #include <stdint.h> | |
| 11 | ||
| 12 | #ifdef __cplusplus | |
| 13 | extern "C" { | |
| 14 | #endif | |
| 15 | ||
| 16 | /** | |
| 17 | * RGB color value. | |
| 18 | * | |
| 19 | * @ingroup sgr | |
| 20 | */ | |
| 21 | typedef struct { | |
| 22 | uint8_t r; /**< Red component (0-255) */ | |
| 23 | uint8_t g; /**< Green component (0-255) */ | |
| 24 | uint8_t b; /**< Blue component (0-255) */ | |
| 25 | } GhosttyColorRgb; | |
| 26 | ||
| 27 | /** | |
| 28 | * Palette color index (0-255). | |
| 29 | * | |
| 30 | * @ingroup sgr | |
| 31 | */ | |
| 32 | typedef uint8_t GhosttyColorPaletteIndex; | |
| 33 | ||
| 34 | /** @addtogroup sgr | |
| 35 | * @{ | |
| 36 | */ | |
| 37 | ||
| 38 | /** Black color (0) @ingroup sgr */ | |
| 39 | #define GHOSTTY_COLOR_NAMED_BLACK 0 | |
| 40 | /** Red color (1) @ingroup sgr */ | |
| 41 | #define GHOSTTY_COLOR_NAMED_RED 1 | |
| 42 | /** Green color (2) @ingroup sgr */ | |
| 43 | #define GHOSTTY_COLOR_NAMED_GREEN 2 | |
| 44 | /** Yellow color (3) @ingroup sgr */ | |
| 45 | #define GHOSTTY_COLOR_NAMED_YELLOW 3 | |
| 46 | /** Blue color (4) @ingroup sgr */ | |
| 47 | #define GHOSTTY_COLOR_NAMED_BLUE 4 | |
| 48 | /** Magenta color (5) @ingroup sgr */ | |
| 49 | #define GHOSTTY_COLOR_NAMED_MAGENTA 5 | |
| 50 | /** Cyan color (6) @ingroup sgr */ | |
| 51 | #define GHOSTTY_COLOR_NAMED_CYAN 6 | |
| 52 | /** White color (7) @ingroup sgr */ | |
| 53 | #define GHOSTTY_COLOR_NAMED_WHITE 7 | |
| 54 | /** Bright black color (8) @ingroup sgr */ | |
| 55 | #define GHOSTTY_COLOR_NAMED_BRIGHT_BLACK 8 | |
| 56 | /** Bright red color (9) @ingroup sgr */ | |
| 57 | #define GHOSTTY_COLOR_NAMED_BRIGHT_RED 9 | |
| 58 | /** Bright green color (10) @ingroup sgr */ | |
| 59 | #define GHOSTTY_COLOR_NAMED_BRIGHT_GREEN 10 | |
| 60 | /** Bright yellow color (11) @ingroup sgr */ | |
| 61 | #define GHOSTTY_COLOR_NAMED_BRIGHT_YELLOW 11 | |
| 62 | /** Bright blue color (12) @ingroup sgr */ | |
| 63 | #define GHOSTTY_COLOR_NAMED_BRIGHT_BLUE 12 | |
| 64 | /** Bright magenta color (13) @ingroup sgr */ | |
| 65 | #define GHOSTTY_COLOR_NAMED_BRIGHT_MAGENTA 13 | |
| 66 | /** Bright cyan color (14) @ingroup sgr */ | |
| 67 | #define GHOSTTY_COLOR_NAMED_BRIGHT_CYAN 14 | |
| 68 | /** Bright white color (15) @ingroup sgr */ | |
| 69 | #define GHOSTTY_COLOR_NAMED_BRIGHT_WHITE 15 | |
| 70 | ||
| 71 | /** @} */ | |
| 72 | ||
| 73 | /** | |
| 74 | * Get the RGB color components. | |
| 75 | * | |
| 76 | * This function extracts the individual red, green, and blue components | |
| 77 | * from a GhosttyColorRgb value. Primarily useful in WebAssembly environments | |
| 78 | * where accessing struct fields directly is difficult. | |
| 79 | * | |
| 80 | * @param color The RGB color value | |
| 81 | * @param r Pointer to store the red component (0-255) | |
| 82 | * @param g Pointer to store the green component (0-255) | |
| 83 | * @param b Pointer to store the blue component (0-255) | |
| 84 | * | |
| 85 | * @ingroup sgr | |
| 86 | */ | |
| 87 | void ghostty_color_rgb_get(GhosttyColorRgb color, | |
| 88 | uint8_t* r, | |
| 89 | uint8_t* g, | |
| 90 | uint8_t* b); | |
| 91 | ||
| 92 | #ifdef __cplusplus | |
| 93 | } | |
| 94 | #endif | |
| 95 | ||
| 96 | #endif /* GHOSTTY_VT_COLOR_H */ |
apps/mobile/modules/t3-terminal/Vendor/libghostty/GhosttyKit.xcframework/ios-arm64/Headers/ghostty/vt/key.h deleted-80| ... | ... | @@ -1,80 +0,0 @@ |
| 1 | /** | |
| 2 | * @file key.h | |
| 3 | * | |
| 4 | * Key encoding module - encode key events into terminal escape sequences. | |
| 5 | */ | |
| 6 | ||
| 7 | #ifndef GHOSTTY_VT_KEY_H | |
| 8 | #define GHOSTTY_VT_KEY_H | |
| 9 | ||
| 10 | /** @defgroup key Key Encoding | |
| 11 | * | |
| 12 | * Utilities for encoding key events into terminal escape sequences, | |
| 13 | * supporting both legacy encoding as well as Kitty Keyboard Protocol. | |
| 14 | * | |
| 15 | * ## Basic Usage | |
| 16 | * | |
| 17 | * 1. Create an encoder instance with ghostty_key_encoder_new() | |
| 18 | * 2. Configure encoder options with ghostty_key_encoder_setopt(). | |
| 19 | * 3. For each key event: | |
| 20 | * - Create a key event with ghostty_key_event_new() | |
| 21 | * - Set event properties (action, key, modifiers, etc.) | |
| 22 | * - Encode with ghostty_key_encoder_encode() | |
| 23 | * - Free the event with ghostty_key_event_free() | |
| 24 | * - Note: You can also reuse the same key event multiple times by | |
| 25 | * changing its properties. | |
| 26 | * 4. Free the encoder with ghostty_key_encoder_free() when done | |
| 27 | * | |
| 28 | * ## Example | |
| 29 | * | |
| 30 | * @code{.c} | |
| 31 | * #include <assert.h> | |
| 32 | * #include <stdio.h> | |
| 33 | * #include <ghostty/vt.h> | |
| 34 | * | |
| 35 | * int main() { | |
| 36 | * // Create encoder | |
| 37 | * GhosttyKeyEncoder encoder; | |
| 38 | * GhosttyResult result = ghostty_key_encoder_new(NULL, &encoder); | |
| 39 | * assert(result == GHOSTTY_SUCCESS); | |
| 40 | * | |
| 41 | * // Enable Kitty keyboard protocol with all features | |
| 42 | * ghostty_key_encoder_setopt(encoder, GHOSTTY_KEY_ENCODER_OPT_KITTY_FLAGS, | |
| 43 | * &(uint8_t){GHOSTTY_KITTY_KEY_ALL}); | |
| 44 | * | |
| 45 | * // Create and configure key event for Ctrl+C press | |
| 46 | * GhosttyKeyEvent event; | |
| 47 | * result = ghostty_key_event_new(NULL, &event); | |
| 48 | * assert(result == GHOSTTY_SUCCESS); | |
| 49 | * ghostty_key_event_set_action(event, GHOSTTY_KEY_ACTION_PRESS); | |
| 50 | * ghostty_key_event_set_key(event, GHOSTTY_KEY_C); | |
| 51 | * ghostty_key_event_set_mods(event, GHOSTTY_MODS_CTRL); | |
| 52 | * | |
| 53 | * // Encode the key event | |
| 54 | * char buf[128]; | |
| 55 | * size_t written = 0; | |
| 56 | * result = ghostty_key_encoder_encode(encoder, event, buf, sizeof(buf), &written); | |
| 57 | * assert(result == GHOSTTY_SUCCESS); | |
| 58 | * | |
| 59 | * // Use the encoded sequence (e.g., write to terminal) | |
| 60 | * fwrite(buf, 1, written, stdout); | |
| 61 | * | |
| 62 | * // Cleanup | |
| 63 | * ghostty_key_event_free(event); | |
| 64 | * ghostty_key_encoder_free(encoder); | |
| 65 | * return 0; | |
| 66 | * } | |
| 67 | * @endcode | |
| 68 | * | |
| 69 | * For a complete working example, see example/c-vt-key-encode in the | |
| 70 | * repository. | |
| 71 | * | |
| 72 | * @{ | |
| 73 | */ | |
| 74 | ||
| 75 | #include <ghostty/vt/key/event.h> | |
| 76 | #include <ghostty/vt/key/encoder.h> | |
| 77 | ||
| 78 | /** @} */ | |
| 79 | ||
| 80 | #endif /* GHOSTTY_VT_KEY_H */ |
apps/mobile/modules/t3-terminal/Vendor/libghostty/GhosttyKit.xcframework/ios-arm64/Headers/ghostty/vt/key/encoder.h deleted-221| ... | ... | @@ -1,221 +0,0 @@ |
| 1 | /** | |
| 2 | * @file encoder.h | |
| 3 | * | |
| 4 | * Key event encoding to terminal escape sequences. | |
| 5 | */ | |
| 6 | ||
| 7 | #ifndef GHOSTTY_VT_KEY_ENCODER_H | |
| 8 | #define GHOSTTY_VT_KEY_ENCODER_H | |
| 9 | ||
| 10 | #include <stddef.h> | |
| 11 | #include <stdint.h> | |
| 12 | #include <ghostty/vt/result.h> | |
| 13 | #include <ghostty/vt/allocator.h> | |
| 14 | #include <ghostty/vt/key/event.h> | |
| 15 | ||
| 16 | /** | |
| 17 | * Opaque handle to a key encoder instance. | |
| 18 | * | |
| 19 | * This handle represents a key encoder that converts key events into terminal | |
| 20 | * escape sequences. | |
| 21 | * | |
| 22 | * @ingroup key | |
| 23 | */ | |
| 24 | typedef struct GhosttyKeyEncoder *GhosttyKeyEncoder; | |
| 25 | ||
| 26 | /** | |
| 27 | * Kitty keyboard protocol flags. | |
| 28 | * | |
| 29 | * Bitflags representing the various modes of the Kitty keyboard protocol. | |
| 30 | * These can be combined using bitwise OR operations. Valid values all | |
| 31 | * start with `GHOSTTY_KITTY_KEY_`. | |
| 32 | * | |
| 33 | * @ingroup key | |
| 34 | */ | |
| 35 | typedef uint8_t GhosttyKittyKeyFlags; | |
| 36 | ||
| 37 | /** Kitty keyboard protocol disabled (all flags off) */ | |
| 38 | #define GHOSTTY_KITTY_KEY_DISABLED 0 | |
| 39 | ||
| 40 | /** Disambiguate escape codes */ | |
| 41 | #define GHOSTTY_KITTY_KEY_DISAMBIGUATE (1 << 0) | |
| 42 | ||
| 43 | /** Report key press and release events */ | |
| 44 | #define GHOSTTY_KITTY_KEY_REPORT_EVENTS (1 << 1) | |
| 45 | ||
| 46 | /** Report alternate key codes */ | |
| 47 | #define GHOSTTY_KITTY_KEY_REPORT_ALTERNATES (1 << 2) | |
| 48 | ||
| 49 | /** Report all key events including those normally handled by the terminal */ | |
| 50 | #define GHOSTTY_KITTY_KEY_REPORT_ALL (1 << 3) | |
| 51 | ||
| 52 | /** Report associated text with key events */ | |
| 53 | #define GHOSTTY_KITTY_KEY_REPORT_ASSOCIATED (1 << 4) | |
| 54 | ||
| 55 | /** All Kitty keyboard protocol flags enabled */ | |
| 56 | #define GHOSTTY_KITTY_KEY_ALL (GHOSTTY_KITTY_KEY_DISAMBIGUATE | GHOSTTY_KITTY_KEY_REPORT_EVENTS | GHOSTTY_KITTY_KEY_REPORT_ALTERNATES | GHOSTTY_KITTY_KEY_REPORT_ALL | GHOSTTY_KITTY_KEY_REPORT_ASSOCIATED) | |
| 57 | ||
| 58 | /** | |
| 59 | * macOS option key behavior. | |
| 60 | * | |
| 61 | * Determines whether the "option" key on macOS is treated as "alt" or not. | |
| 62 | * See the Ghostty `macos-option-as-alt` configuration option for more details. | |
| 63 | * | |
| 64 | * @ingroup key | |
| 65 | */ | |
| 66 | typedef enum { | |
| 67 | /** Option key is not treated as alt */ | |
| 68 | GHOSTTY_OPTION_AS_ALT_FALSE = 0, | |
| 69 | /** Option key is treated as alt */ | |
| 70 | GHOSTTY_OPTION_AS_ALT_TRUE = 1, | |
| 71 | /** Only left option key is treated as alt */ | |
| 72 | GHOSTTY_OPTION_AS_ALT_LEFT = 2, | |
| 73 | /** Only right option key is treated as alt */ | |
| 74 | GHOSTTY_OPTION_AS_ALT_RIGHT = 3, | |
| 75 | } GhosttyOptionAsAlt; | |
| 76 | ||
| 77 | /** | |
| 78 | * Key encoder option identifiers. | |
| 79 | * | |
| 80 | * These values are used with ghostty_key_encoder_setopt() to configure | |
| 81 | * the behavior of the key encoder. | |
| 82 | * | |
| 83 | * @ingroup key | |
| 84 | */ | |
| 85 | typedef enum { | |
| 86 | /** Terminal DEC mode 1: cursor key application mode (value: bool) */ | |
| 87 | GHOSTTY_KEY_ENCODER_OPT_CURSOR_KEY_APPLICATION = 0, | |
| 88 | ||
| 89 | /** Terminal DEC mode 66: keypad key application mode (value: bool) */ | |
| 90 | GHOSTTY_KEY_ENCODER_OPT_KEYPAD_KEY_APPLICATION = 1, | |
| 91 | ||
| 92 | /** Terminal DEC mode 1035: ignore keypad with numlock (value: bool) */ | |
| 93 | GHOSTTY_KEY_ENCODER_OPT_IGNORE_KEYPAD_WITH_NUMLOCK = 2, | |
| 94 | ||
| 95 | /** Terminal DEC mode 1036: alt sends escape prefix (value: bool) */ | |
| 96 | GHOSTTY_KEY_ENCODER_OPT_ALT_ESC_PREFIX = 3, | |
| 97 | ||
| 98 | /** xterm modifyOtherKeys mode 2 (value: bool) */ | |
| 99 | GHOSTTY_KEY_ENCODER_OPT_MODIFY_OTHER_KEYS_STATE_2 = 4, | |
| 100 | ||
| 101 | /** Kitty keyboard protocol flags (value: GhosttyKittyKeyFlags bitmask) */ | |
| 102 | GHOSTTY_KEY_ENCODER_OPT_KITTY_FLAGS = 5, | |
| 103 | ||
| 104 | /** macOS option-as-alt setting (value: GhosttyOptionAsAlt) */ | |
| 105 | GHOSTTY_KEY_ENCODER_OPT_MACOS_OPTION_AS_ALT = 6, | |
| 106 | } GhosttyKeyEncoderOption; | |
| 107 | ||
| 108 | /** | |
| 109 | * Create a new key encoder instance. | |
| 110 | * | |
| 111 | * Creates a new key encoder with default options. The encoder can be configured | |
| 112 | * using ghostty_key_encoder_setopt() and must be freed using | |
| 113 | * ghostty_key_encoder_free() when no longer needed. | |
| 114 | * | |
| 115 | * @param allocator Pointer to the allocator to use for memory management, or NULL to use the default allocator | |
| 116 | * @param encoder Pointer to store the created encoder handle | |
| 117 | * @return GHOSTTY_SUCCESS on success, or an error code on failure | |
| 118 | * | |
| 119 | * @ingroup key | |
| 120 | */ | |
| 121 | GhosttyResult ghostty_key_encoder_new(const GhosttyAllocator *allocator, GhosttyKeyEncoder *encoder); | |
| 122 | ||
| 123 | /** | |
| 124 | * Free a key encoder instance. | |
| 125 | * | |
| 126 | * Releases all resources associated with the key encoder. After this call, | |
| 127 | * the encoder handle becomes invalid and must not be used. | |
| 128 | * | |
| 129 | * @param encoder The encoder handle to free (may be NULL) | |
| 130 | * | |
| 131 | * @ingroup key | |
| 132 | */ | |
| 133 | void ghostty_key_encoder_free(GhosttyKeyEncoder encoder); | |
| 134 | ||
| 135 | /** | |
| 136 | * Set an option on the key encoder. | |
| 137 | * | |
| 138 | * Configures the behavior of the key encoder. Options control various aspects | |
| 139 | * of encoding such as terminal modes (cursor key application mode, keypad mode), | |
| 140 | * protocol selection (Kitty keyboard protocol flags), and platform-specific | |
| 141 | * behaviors (macOS option-as-alt). | |
| 142 | * | |
| 143 | * A null pointer value does nothing. It does not reset the value to the | |
| 144 | * default. The setopt call will do nothing. | |
| 145 | * | |
| 146 | * @param encoder The encoder handle, must not be NULL | |
| 147 | * @param option The option to set | |
| 148 | * @param value Pointer to the value to set (type depends on the option) | |
| 149 | * | |
| 150 | * @ingroup key | |
| 151 | */ | |
| 152 | void ghostty_key_encoder_setopt(GhosttyKeyEncoder encoder, GhosttyKeyEncoderOption option, const void *value); | |
| 153 | ||
| 154 | /** | |
| 155 | * Encode a key event into a terminal escape sequence. | |
| 156 | * | |
| 157 | * Converts a key event into the appropriate terminal escape sequence based on | |
| 158 | * the encoder's current options. The sequence is written to the provided buffer. | |
| 159 | * | |
| 160 | * Not all key events produce output. For example, unmodified modifier keys | |
| 161 | * typically don't generate escape sequences. Check the out_len parameter to | |
| 162 | * determine if any data was written. | |
| 163 | * | |
| 164 | * If the output buffer is too small, this function returns GHOSTTY_OUT_OF_MEMORY | |
| 165 | * and out_len will contain the required buffer size. The caller can then | |
| 166 | * allocate a larger buffer and call the function again. | |
| 167 | * | |
| 168 | * @param encoder The encoder handle, must not be NULL | |
| 169 | * @param event The key event to encode, must not be NULL | |
| 170 | * @param out_buf Buffer to write the encoded sequence to | |
| 171 | * @param out_buf_size Size of the output buffer in bytes | |
| 172 | * @param out_len Pointer to store the number of bytes written (may be NULL) | |
| 173 | * @return GHOSTTY_SUCCESS on success, GHOSTTY_OUT_OF_MEMORY if buffer too small, or other error code | |
| 174 | * | |
| 175 | * ## Example: Calculate required buffer size | |
| 176 | * | |
| 177 | * @code{.c} | |
| 178 | * // Query the required size with a NULL buffer (always returns OUT_OF_MEMORY) | |
| 179 | * size_t required = 0; | |
| 180 | * GhosttyResult result = ghostty_key_encoder_encode(encoder, event, NULL, 0, &required); | |
| 181 | * assert(result == GHOSTTY_OUT_OF_MEMORY); | |
| 182 | * | |
| 183 | * // Allocate buffer of required size | |
| 184 | * char *buf = malloc(required); | |
| 185 | * | |
| 186 | * // Encode with properly sized buffer | |
| 187 | * size_t written = 0; | |
| 188 | * result = ghostty_key_encoder_encode(encoder, event, buf, required, &written); | |
| 189 | * assert(result == GHOSTTY_SUCCESS); | |
| 190 | * | |
| 191 | * // Use the encoded sequence... | |
| 192 | * | |
| 193 | * free(buf); | |
| 194 | * @endcode | |
| 195 | * | |
| 196 | * ## Example: Direct encoding with static buffer | |
| 197 | * | |
| 198 | * @code{.c} | |
| 199 | * // Most escape sequences are short, so a static buffer often suffices | |
| 200 | * char buf[128]; | |
| 201 | * size_t written = 0; | |
| 202 | * GhosttyResult result = ghostty_key_encoder_encode(encoder, event, buf, sizeof(buf), &written); | |
| 203 | * | |
| 204 | * if (result == GHOSTTY_SUCCESS) { | |
| 205 | * // Write the encoded sequence to the terminal | |
| 206 | * write(pty_fd, buf, written); | |
| 207 | * } else if (result == GHOSTTY_OUT_OF_MEMORY) { | |
| 208 | * // Buffer too small, written contains required size | |
| 209 | * char *dynamic_buf = malloc(written); | |
| 210 | * result = ghostty_key_encoder_encode(encoder, event, dynamic_buf, written, &written); | |
| 211 | * assert(result == GHOSTTY_SUCCESS); | |
| 212 | * write(pty_fd, dynamic_buf, written); | |
| 213 | * free(dynamic_buf); | |
| 214 | * } | |
| 215 | * @endcode | |
| 216 | * | |
| 217 | * @ingroup key | |
| 218 | */ | |
| 219 | GhosttyResult ghostty_key_encoder_encode(GhosttyKeyEncoder encoder, GhosttyKeyEvent event, char *out_buf, size_t out_buf_size, size_t *out_len); | |
| 220 | ||
| 221 | #endif /* GHOSTTY_VT_KEY_ENCODER_H */ |
apps/mobile/modules/t3-terminal/Vendor/libghostty/GhosttyKit.xcframework/ios-arm64/Headers/ghostty/vt/key/event.h deleted-474| ... | ... | @@ -1,474 +0,0 @@ |
| 1 | /** | |
| 2 | * @file event.h | |
| 3 | * | |
| 4 | * Key event representation and manipulation. | |
| 5 | */ | |
| 6 | ||
| 7 | #ifndef GHOSTTY_VT_KEY_EVENT_H | |
| 8 | #define GHOSTTY_VT_KEY_EVENT_H | |
| 9 | ||
| 10 | #include <stdbool.h> | |
| 11 | #include <stddef.h> | |
| 12 | #include <stdint.h> | |
| 13 | #include <ghostty/vt/result.h> | |
| 14 | #include <ghostty/vt/allocator.h> | |
| 15 | ||
| 16 | /** | |
| 17 | * Opaque handle to a key event. | |
| 18 | * | |
| 19 | * This handle represents a keyboard input event containing information about | |
| 20 | * the physical key pressed, modifiers, and generated text. | |
| 21 | * | |
| 22 | * @ingroup key | |
| 23 | */ | |
| 24 | typedef struct GhosttyKeyEvent *GhosttyKeyEvent; | |
| 25 | ||
| 26 | /** | |
| 27 | * Keyboard input event types. | |
| 28 | * | |
| 29 | * @ingroup key | |
| 30 | */ | |
| 31 | typedef enum { | |
| 32 | /** Key was released */ | |
| 33 | GHOSTTY_KEY_ACTION_RELEASE = 0, | |
| 34 | /** Key was pressed */ | |
| 35 | GHOSTTY_KEY_ACTION_PRESS = 1, | |
| 36 | /** Key is being repeated (held down) */ | |
| 37 | GHOSTTY_KEY_ACTION_REPEAT = 2, | |
| 38 | } GhosttyKeyAction; | |
| 39 | ||
| 40 | /** | |
| 41 | * Keyboard modifier keys bitmask. | |
| 42 | * | |
| 43 | * A bitmask representing all keyboard modifiers. This tracks which modifier keys | |
| 44 | * are pressed and, where supported by the platform, which side (left or right) | |
| 45 | * of each modifier is active. | |
| 46 | * | |
| 47 | * Use the GHOSTTY_MODS_* constants to test and set individual modifiers. | |
| 48 | * | |
| 49 | * Modifier side bits are only meaningful when the corresponding modifier bit is set. | |
| 50 | * Not all platforms support distinguishing between left and right modifier | |
| 51 | * keys and Ghostty is built to expect that some platforms may not provide this | |
| 52 | * information. | |
| 53 | * | |
| 54 | * @ingroup key | |
| 55 | */ | |
| 56 | typedef uint16_t GhosttyMods; | |
| 57 | ||
| 58 | /** Shift key is pressed */ | |
| 59 | #define GHOSTTY_MODS_SHIFT (1 << 0) | |
| 60 | /** Control key is pressed */ | |
| 61 | #define GHOSTTY_MODS_CTRL (1 << 1) | |
| 62 | /** Alt/Option key is pressed */ | |
| 63 | #define GHOSTTY_MODS_ALT (1 << 2) | |
| 64 | /** Super/Command/Windows key is pressed */ | |
| 65 | #define GHOSTTY_MODS_SUPER (1 << 3) | |
| 66 | /** Caps Lock is active */ | |
| 67 | #define GHOSTTY_MODS_CAPS_LOCK (1 << 4) | |
| 68 | /** Num Lock is active */ | |
| 69 | #define GHOSTTY_MODS_NUM_LOCK (1 << 5) | |
| 70 | ||
| 71 | /** | |
| 72 | * Right shift is pressed (0 = left, 1 = right). | |
| 73 | * Only meaningful when GHOSTTY_MODS_SHIFT is set. | |
| 74 | */ | |
| 75 | #define GHOSTTY_MODS_SHIFT_SIDE (1 << 6) | |
| 76 | /** | |
| 77 | * Right ctrl is pressed (0 = left, 1 = right). | |
| 78 | * Only meaningful when GHOSTTY_MODS_CTRL is set. | |
| 79 | */ | |
| 80 | #define GHOSTTY_MODS_CTRL_SIDE (1 << 7) | |
| 81 | /** | |
| 82 | * Right alt is pressed (0 = left, 1 = right). | |
| 83 | * Only meaningful when GHOSTTY_MODS_ALT is set. | |
| 84 | */ | |
| 85 | #define GHOSTTY_MODS_ALT_SIDE (1 << 8) | |
| 86 | /** | |
| 87 | * Right super is pressed (0 = left, 1 = right). | |
| 88 | * Only meaningful when GHOSTTY_MODS_SUPER is set. | |
| 89 | */ | |
| 90 | #define GHOSTTY_MODS_SUPER_SIDE (1 << 9) | |
| 91 | ||
| 92 | /** | |
| 93 | * Physical key codes. | |
| 94 | * | |
| 95 | * The set of key codes that Ghostty is aware of. These represent physical keys | |
| 96 | * on the keyboard and are layout-independent. For example, the "a" key on a US | |
| 97 | * keyboard is the same as the "ф" key on a Russian keyboard, but both will | |
| 98 | * report the same key_a value. | |
| 99 | * | |
| 100 | * Layout-dependent strings are provided separately as UTF-8 text and are produced | |
| 101 | * by the platform. These values are based on the W3C UI Events KeyboardEvent code | |
| 102 | * standard. See: https://www.w3.org/TR/uievents-code | |
| 103 | * | |
| 104 | * @ingroup key | |
| 105 | */ | |
| 106 | typedef enum { | |
| 107 | GHOSTTY_KEY_UNIDENTIFIED = 0, | |
| 108 | ||
| 109 | // Writing System Keys (W3C § 3.1.1) | |
| 110 | GHOSTTY_KEY_BACKQUOTE, | |
| 111 | GHOSTTY_KEY_BACKSLASH, | |
| 112 | GHOSTTY_KEY_BRACKET_LEFT, | |
| 113 | GHOSTTY_KEY_BRACKET_RIGHT, | |
| 114 | GHOSTTY_KEY_COMMA, | |
| 115 | GHOSTTY_KEY_DIGIT_0, | |
| 116 | GHOSTTY_KEY_DIGIT_1, | |
| 117 | GHOSTTY_KEY_DIGIT_2, | |
| 118 | GHOSTTY_KEY_DIGIT_3, | |
| 119 | GHOSTTY_KEY_DIGIT_4, | |
| 120 | GHOSTTY_KEY_DIGIT_5, | |
| 121 | GHOSTTY_KEY_DIGIT_6, | |
| 122 | GHOSTTY_KEY_DIGIT_7, | |
| 123 | GHOSTTY_KEY_DIGIT_8, | |
| 124 | GHOSTTY_KEY_DIGIT_9, | |
| 125 | GHOSTTY_KEY_EQUAL, | |
| 126 | GHOSTTY_KEY_INTL_BACKSLASH, | |
| 127 | GHOSTTY_KEY_INTL_RO, | |
| 128 | GHOSTTY_KEY_INTL_YEN, | |
| 129 | GHOSTTY_KEY_A, | |
| 130 | GHOSTTY_KEY_B, | |
| 131 | GHOSTTY_KEY_C, | |
| 132 | GHOSTTY_KEY_D, | |
| 133 | GHOSTTY_KEY_E, | |
| 134 | GHOSTTY_KEY_F, | |
| 135 | GHOSTTY_KEY_G, | |
| 136 | GHOSTTY_KEY_H, | |
| 137 | GHOSTTY_KEY_I, | |
| 138 | GHOSTTY_KEY_J, | |
| 139 | GHOSTTY_KEY_K, | |
| 140 | GHOSTTY_KEY_L, | |
| 141 | GHOSTTY_KEY_M, | |
| 142 | GHOSTTY_KEY_N, | |
| 143 | GHOSTTY_KEY_O, | |
| 144 | GHOSTTY_KEY_P, | |
| 145 | GHOSTTY_KEY_Q, | |
| 146 | GHOSTTY_KEY_R, | |
| 147 | GHOSTTY_KEY_S, | |
| 148 | GHOSTTY_KEY_T, | |
| 149 | GHOSTTY_KEY_U, | |
| 150 | GHOSTTY_KEY_V, | |
| 151 | GHOSTTY_KEY_W, | |
| 152 | GHOSTTY_KEY_X, | |
| 153 | GHOSTTY_KEY_Y, | |
| 154 | GHOSTTY_KEY_Z, | |
| 155 | GHOSTTY_KEY_MINUS, | |
| 156 | GHOSTTY_KEY_PERIOD, | |
| 157 | GHOSTTY_KEY_QUOTE, | |
| 158 | GHOSTTY_KEY_SEMICOLON, | |
| 159 | GHOSTTY_KEY_SLASH, | |
| 160 | ||
| 161 | // Functional Keys (W3C § 3.1.2) | |
| 162 | GHOSTTY_KEY_ALT_LEFT, | |
| 163 | GHOSTTY_KEY_ALT_RIGHT, | |
| 164 | GHOSTTY_KEY_BACKSPACE, | |
| 165 | GHOSTTY_KEY_CAPS_LOCK, | |
| 166 | GHOSTTY_KEY_CONTEXT_MENU, | |
| 167 | GHOSTTY_KEY_CONTROL_LEFT, | |
| 168 | GHOSTTY_KEY_CONTROL_RIGHT, | |
| 169 | GHOSTTY_KEY_ENTER, | |
| 170 | GHOSTTY_KEY_META_LEFT, | |
| 171 | GHOSTTY_KEY_META_RIGHT, | |
| 172 | GHOSTTY_KEY_SHIFT_LEFT, | |
| 173 | GHOSTTY_KEY_SHIFT_RIGHT, | |
| 174 | GHOSTTY_KEY_SPACE, | |
| 175 | GHOSTTY_KEY_TAB, | |
| 176 | GHOSTTY_KEY_CONVERT, | |
| 177 | GHOSTTY_KEY_KANA_MODE, | |
| 178 | GHOSTTY_KEY_NON_CONVERT, | |
| 179 | ||
| 180 | // Control Pad Section (W3C § 3.2) | |
| 181 | GHOSTTY_KEY_DELETE, | |
| 182 | GHOSTTY_KEY_END, | |
| 183 | GHOSTTY_KEY_HELP, | |
| 184 | GHOSTTY_KEY_HOME, | |
| 185 | GHOSTTY_KEY_INSERT, | |
| 186 | GHOSTTY_KEY_PAGE_DOWN, | |
| 187 | GHOSTTY_KEY_PAGE_UP, | |
| 188 | ||
| 189 | // Arrow Pad Section (W3C § 3.3) | |
| 190 | GHOSTTY_KEY_ARROW_DOWN, | |
| 191 | GHOSTTY_KEY_ARROW_LEFT, | |
| 192 | GHOSTTY_KEY_ARROW_RIGHT, | |
| 193 | GHOSTTY_KEY_ARROW_UP, | |
| 194 | ||
| 195 | // Numpad Section (W3C § 3.4) | |
| 196 | GHOSTTY_KEY_NUM_LOCK, | |
| 197 | GHOSTTY_KEY_NUMPAD_0, | |
| 198 | GHOSTTY_KEY_NUMPAD_1, | |
| 199 | GHOSTTY_KEY_NUMPAD_2, | |
| 200 | GHOSTTY_KEY_NUMPAD_3, | |
| 201 | GHOSTTY_KEY_NUMPAD_4, | |
| 202 | GHOSTTY_KEY_NUMPAD_5, | |
| 203 | GHOSTTY_KEY_NUMPAD_6, | |
| 204 | GHOSTTY_KEY_NUMPAD_7, | |
| 205 | GHOSTTY_KEY_NUMPAD_8, | |
| 206 | GHOSTTY_KEY_NUMPAD_9, | |
| 207 | GHOSTTY_KEY_NUMPAD_ADD, | |
| 208 | GHOSTTY_KEY_NUMPAD_BACKSPACE, | |
| 209 | GHOSTTY_KEY_NUMPAD_CLEAR, | |
| 210 | GHOSTTY_KEY_NUMPAD_CLEAR_ENTRY, | |
| 211 | GHOSTTY_KEY_NUMPAD_COMMA, | |
| 212 | GHOSTTY_KEY_NUMPAD_DECIMAL, | |
| 213 | GHOSTTY_KEY_NUMPAD_DIVIDE, | |
| 214 | GHOSTTY_KEY_NUMPAD_ENTER, | |
| 215 | GHOSTTY_KEY_NUMPAD_EQUAL, | |
| 216 | GHOSTTY_KEY_NUMPAD_MEMORY_ADD, | |
| 217 | GHOSTTY_KEY_NUMPAD_MEMORY_CLEAR, | |
| 218 | GHOSTTY_KEY_NUMPAD_MEMORY_RECALL, | |
| 219 | GHOSTTY_KEY_NUMPAD_MEMORY_STORE, | |
| 220 | GHOSTTY_KEY_NUMPAD_MEMORY_SUBTRACT, | |
| 221 | GHOSTTY_KEY_NUMPAD_MULTIPLY, | |
| 222 | GHOSTTY_KEY_NUMPAD_PAREN_LEFT, | |
| 223 | GHOSTTY_KEY_NUMPAD_PAREN_RIGHT, | |
| 224 | GHOSTTY_KEY_NUMPAD_SUBTRACT, | |
| 225 | GHOSTTY_KEY_NUMPAD_SEPARATOR, | |
| 226 | GHOSTTY_KEY_NUMPAD_UP, | |
| 227 | GHOSTTY_KEY_NUMPAD_DOWN, | |
| 228 | GHOSTTY_KEY_NUMPAD_RIGHT, | |
| 229 | GHOSTTY_KEY_NUMPAD_LEFT, | |
| 230 | GHOSTTY_KEY_NUMPAD_BEGIN, | |
| 231 | GHOSTTY_KEY_NUMPAD_HOME, | |
| 232 | GHOSTTY_KEY_NUMPAD_END, | |
| 233 | GHOSTTY_KEY_NUMPAD_INSERT, | |
| 234 | GHOSTTY_KEY_NUMPAD_DELETE, | |
| 235 | GHOSTTY_KEY_NUMPAD_PAGE_UP, | |
| 236 | GHOSTTY_KEY_NUMPAD_PAGE_DOWN, | |
| 237 | ||
| 238 | // Function Section (W3C § 3.5) | |
| 239 | GHOSTTY_KEY_ESCAPE, | |
| 240 | GHOSTTY_KEY_F1, | |
| 241 | GHOSTTY_KEY_F2, | |
| 242 | GHOSTTY_KEY_F3, | |
| 243 | GHOSTTY_KEY_F4, | |
| 244 | GHOSTTY_KEY_F5, | |
| 245 | GHOSTTY_KEY_F6, | |
| 246 | GHOSTTY_KEY_F7, | |
| 247 | GHOSTTY_KEY_F8, | |
| 248 | GHOSTTY_KEY_F9, | |
| 249 | GHOSTTY_KEY_F10, | |
| 250 | GHOSTTY_KEY_F11, | |
| 251 | GHOSTTY_KEY_F12, | |
| 252 | GHOSTTY_KEY_F13, | |
| 253 | GHOSTTY_KEY_F14, | |
| 254 | GHOSTTY_KEY_F15, | |
| 255 | GHOSTTY_KEY_F16, | |
| 256 | GHOSTTY_KEY_F17, | |
| 257 | GHOSTTY_KEY_F18, | |
| 258 | GHOSTTY_KEY_F19, | |
| 259 | GHOSTTY_KEY_F20, | |
| 260 | GHOSTTY_KEY_F21, | |
| 261 | GHOSTTY_KEY_F22, | |
| 262 | GHOSTTY_KEY_F23, | |
| 263 | GHOSTTY_KEY_F24, | |
| 264 | GHOSTTY_KEY_F25, | |
| 265 | GHOSTTY_KEY_FN, | |
| 266 | GHOSTTY_KEY_FN_LOCK, | |
| 267 | GHOSTTY_KEY_PRINT_SCREEN, | |
| 268 | GHOSTTY_KEY_SCROLL_LOCK, | |
| 269 | GHOSTTY_KEY_PAUSE, | |
| 270 | ||
| 271 | // Media Keys (W3C § 3.6) | |
| 272 | GHOSTTY_KEY_BROWSER_BACK, | |
| 273 | GHOSTTY_KEY_BROWSER_FAVORITES, | |
| 274 | GHOSTTY_KEY_BROWSER_FORWARD, | |
| 275 | GHOSTTY_KEY_BROWSER_HOME, | |
| 276 | GHOSTTY_KEY_BROWSER_REFRESH, | |
| 277 | GHOSTTY_KEY_BROWSER_SEARCH, | |
| 278 | GHOSTTY_KEY_BROWSER_STOP, | |
| 279 | GHOSTTY_KEY_EJECT, | |
| 280 | GHOSTTY_KEY_LAUNCH_APP_1, | |
| 281 | GHOSTTY_KEY_LAUNCH_APP_2, | |
| 282 | GHOSTTY_KEY_LAUNCH_MAIL, | |
| 283 | GHOSTTY_KEY_MEDIA_PLAY_PAUSE, | |
| 284 | GHOSTTY_KEY_MEDIA_SELECT, | |
| 285 | GHOSTTY_KEY_MEDIA_STOP, | |
| 286 | GHOSTTY_KEY_MEDIA_TRACK_NEXT, | |
| 287 | GHOSTTY_KEY_MEDIA_TRACK_PREVIOUS, | |
| 288 | GHOSTTY_KEY_POWER, | |
| 289 | GHOSTTY_KEY_SLEEP, | |
| 290 | GHOSTTY_KEY_AUDIO_VOLUME_DOWN, | |
| 291 | GHOSTTY_KEY_AUDIO_VOLUME_MUTE, | |
| 292 | GHOSTTY_KEY_AUDIO_VOLUME_UP, | |
| 293 | GHOSTTY_KEY_WAKE_UP, | |
| 294 | ||
| 295 | // Legacy, Non-standard, and Special Keys (W3C § 3.7) | |
| 296 | GHOSTTY_KEY_COPY, | |
| 297 | GHOSTTY_KEY_CUT, | |
| 298 | GHOSTTY_KEY_PASTE, | |
| 299 | } GhosttyKey; | |
| 300 | ||
| 301 | /** | |
| 302 | * Create a new key event instance. | |
| 303 | * | |
| 304 | * Creates a new key event with default values. The event must be freed using | |
| 305 | * ghostty_key_event_free() when no longer needed. | |
| 306 | * | |
| 307 | * @param allocator Pointer to the allocator to use for memory management, or NULL to use the default allocator | |
| 308 | * @param event Pointer to store the created key event handle | |
| 309 | * @return GHOSTTY_SUCCESS on success, or an error code on failure | |
| 310 | * | |
| 311 | * @ingroup key | |
| 312 | */ | |
| 313 | GhosttyResult ghostty_key_event_new(const GhosttyAllocator *allocator, GhosttyKeyEvent *event); | |
| 314 | ||
| 315 | /** | |
| 316 | * Free a key event instance. | |
| 317 | * | |
| 318 | * Releases all resources associated with the key event. After this call, | |
| 319 | * the event handle becomes invalid and must not be used. | |
| 320 | * | |
| 321 | * @param event The key event handle to free (may be NULL) | |
| 322 | * | |
| 323 | * @ingroup key | |
| 324 | */ | |
| 325 | void ghostty_key_event_free(GhosttyKeyEvent event); | |
| 326 | ||
| 327 | /** | |
| 328 | * Set the key action (press, release, repeat). | |
| 329 | * | |
| 330 | * @param event The key event handle, must not be NULL | |
| 331 | * @param action The action to set | |
| 332 | * | |
| 333 | * @ingroup key | |
| 334 | */ | |
| 335 | void ghostty_key_event_set_action(GhosttyKeyEvent event, GhosttyKeyAction action); | |
| 336 | ||
| 337 | /** | |
| 338 | * Get the key action (press, release, repeat). | |
| 339 | * | |
| 340 | * @param event The key event handle, must not be NULL | |
| 341 | * @return The key action | |
| 342 | * | |
| 343 | * @ingroup key | |
| 344 | */ | |
| 345 | GhosttyKeyAction ghostty_key_event_get_action(GhosttyKeyEvent event); | |
| 346 | ||
| 347 | /** | |
| 348 | * Set the physical key code. | |
| 349 | * | |
| 350 | * @param event The key event handle, must not be NULL | |
| 351 | * @param key The physical key code to set | |
| 352 | * | |
| 353 | * @ingroup key | |
| 354 | */ | |
| 355 | void ghostty_key_event_set_key(GhosttyKeyEvent event, GhosttyKey key); | |
| 356 | ||
| 357 | /** | |
| 358 | * Get the physical key code. | |
| 359 | * | |
| 360 | * @param event The key event handle, must not be NULL | |
| 361 | * @return The physical key code | |
| 362 | * | |
| 363 | * @ingroup key | |
| 364 | */ | |
| 365 | GhosttyKey ghostty_key_event_get_key(GhosttyKeyEvent event); | |
| 366 | ||
| 367 | /** | |
| 368 | * Set the modifier keys bitmask. | |
| 369 | * | |
| 370 | * @param event The key event handle, must not be NULL | |
| 371 | * @param mods The modifier keys bitmask to set | |
| 372 | * | |
| 373 | * @ingroup key | |
| 374 | */ | |
| 375 | void ghostty_key_event_set_mods(GhosttyKeyEvent event, GhosttyMods mods); | |
| 376 | ||
| 377 | /** | |
| 378 | * Get the modifier keys bitmask. | |
| 379 | * | |
| 380 | * @param event The key event handle, must not be NULL | |
| 381 | * @return The modifier keys bitmask | |
| 382 | * | |
| 383 | * @ingroup key | |
| 384 | */ | |
| 385 | GhosttyMods ghostty_key_event_get_mods(GhosttyKeyEvent event); | |
| 386 | ||
| 387 | /** | |
| 388 | * Set the consumed modifiers bitmask. | |
| 389 | * | |
| 390 | * @param event The key event handle, must not be NULL | |
| 391 | * @param consumed_mods The consumed modifiers bitmask to set | |
| 392 | * | |
| 393 | * @ingroup key | |
| 394 | */ | |
| 395 | void ghostty_key_event_set_consumed_mods(GhosttyKeyEvent event, GhosttyMods consumed_mods); | |
| 396 | ||
| 397 | /** | |
| 398 | * Get the consumed modifiers bitmask. | |
| 399 | * | |
| 400 | * @param event The key event handle, must not be NULL | |
| 401 | * @return The consumed modifiers bitmask | |
| 402 | * | |
| 403 | * @ingroup key | |
| 404 | */ | |
| 405 | GhosttyMods ghostty_key_event_get_consumed_mods(GhosttyKeyEvent event); | |
| 406 | ||
| 407 | /** | |
| 408 | * Set whether the key event is part of a composition sequence. | |
| 409 | * | |
| 410 | * @param event The key event handle, must not be NULL | |
| 411 | * @param composing Whether the key event is part of a composition sequence | |
| 412 | * | |
| 413 | * @ingroup key | |
| 414 | */ | |
| 415 | void ghostty_key_event_set_composing(GhosttyKeyEvent event, bool composing); | |
| 416 | ||
| 417 | /** | |
| 418 | * Get whether the key event is part of a composition sequence. | |
| 419 | * | |
| 420 | * @param event The key event handle, must not be NULL | |
| 421 | * @return Whether the key event is part of a composition sequence | |
| 422 | * | |
| 423 | * @ingroup key | |
| 424 | */ | |
| 425 | bool ghostty_key_event_get_composing(GhosttyKeyEvent event); | |
| 426 | ||
| 427 | /** | |
| 428 | * Set the UTF-8 text generated by the key event. | |
| 429 | * | |
| 430 | * The key event does NOT take ownership of the text pointer. The caller | |
| 431 | * must ensure the string remains valid for the lifetime needed by the event. | |
| 432 | * | |
| 433 | * @param event The key event handle, must not be NULL | |
| 434 | * @param utf8 The UTF-8 text to set (or NULL for empty) | |
| 435 | * @param len Length of the UTF-8 text in bytes | |
| 436 | * | |
| 437 | * @ingroup key | |
| 438 | */ | |
| 439 | void ghostty_key_event_set_utf8(GhosttyKeyEvent event, const char *utf8, size_t len); | |
| 440 | ||
| 441 | /** | |
| 442 | * Get the UTF-8 text generated by the key event. | |
| 443 | * | |
| 444 | * The returned pointer is valid until the event is freed or the UTF-8 text is modified. | |
| 445 | * | |
| 446 | * @param event The key event handle, must not be NULL | |
| 447 | * @param len Pointer to store the length of the UTF-8 text in bytes (may be NULL) | |
| 448 | * @return The UTF-8 text (or NULL for empty) | |
| 449 | * | |
| 450 | * @ingroup key | |
| 451 | */ | |
| 452 | const char *ghostty_key_event_get_utf8(GhosttyKeyEvent event, size_t *len); | |
| 453 | ||
| 454 | /** | |
| 455 | * Set the unshifted Unicode codepoint. | |
| 456 | * | |
| 457 | * @param event The key event handle, must not be NULL | |
| 458 | * @param codepoint The unshifted Unicode codepoint to set | |
| 459 | * | |
| 460 | * @ingroup key | |
| 461 | */ | |
| 462 | void ghostty_key_event_set_unshifted_codepoint(GhosttyKeyEvent event, uint32_t codepoint); | |
| 463 | ||
| 464 | /** | |
| 465 | * Get the unshifted Unicode codepoint. | |
| 466 | * | |
| 467 | * @param event The key event handle, must not be NULL | |
| 468 | * @return The unshifted Unicode codepoint | |
| 469 | * | |
| 470 | * @ingroup key | |
| 471 | */ | |
| 472 | uint32_t ghostty_key_event_get_unshifted_codepoint(GhosttyKeyEvent event); | |
| 473 | ||
| 474 | #endif /* GHOSTTY_VT_KEY_EVENT_H */ |
apps/mobile/modules/t3-terminal/Vendor/libghostty/GhosttyKit.xcframework/ios-arm64/Headers/ghostty/vt/osc.h deleted-233| ... | ... | @@ -1,233 +0,0 @@ |
| 1 | /** | |
| 2 | * @file osc.h | |
| 3 | * | |
| 4 | * OSC (Operating System Command) sequence parser and command handling. | |
| 5 | */ | |
| 6 | ||
| 7 | #ifndef GHOSTTY_VT_OSC_H | |
| 8 | #define GHOSTTY_VT_OSC_H | |
| 9 | ||
| 10 | #include <stdbool.h> | |
| 11 | #include <stddef.h> | |
| 12 | #include <stdint.h> | |
| 13 | #include <ghostty/vt/result.h> | |
| 14 | #include <ghostty/vt/allocator.h> | |
| 15 | ||
| 16 | /** | |
| 17 | * Opaque handle to an OSC parser instance. | |
| 18 | * | |
| 19 | * This handle represents an OSC (Operating System Command) parser that can | |
| 20 | * be used to parse the contents of OSC sequences. | |
| 21 | * | |
| 22 | * @ingroup osc | |
| 23 | */ | |
| 24 | typedef struct GhosttyOscParser *GhosttyOscParser; | |
| 25 | ||
| 26 | /** | |
| 27 | * Opaque handle to a single OSC command. | |
| 28 | * | |
| 29 | * This handle represents a parsed OSC (Operating System Command) command. | |
| 30 | * The command can be queried for its type and associated data. | |
| 31 | * | |
| 32 | * @ingroup osc | |
| 33 | */ | |
| 34 | typedef struct GhosttyOscCommand *GhosttyOscCommand; | |
| 35 | ||
| 36 | /** @defgroup osc OSC Parser | |
| 37 | * | |
| 38 | * OSC (Operating System Command) sequence parser and command handling. | |
| 39 | * | |
| 40 | * The parser operates in a streaming fashion, processing input byte-by-byte | |
| 41 | * to handle OSC sequences that may arrive in fragments across multiple reads. | |
| 42 | * This interface makes it easy to integrate into most environments and avoids | |
| 43 | * over-allocating buffers. | |
| 44 | * | |
| 45 | * ## Basic Usage | |
| 46 | * | |
| 47 | * 1. Create a parser instance with ghostty_osc_new() | |
| 48 | * 2. Feed bytes to the parser using ghostty_osc_next() | |
| 49 | * 3. Finalize parsing with ghostty_osc_end() to get the command | |
| 50 | * 4. Query command type and extract data using ghostty_osc_command_type() | |
| 51 | * and ghostty_osc_command_data() | |
| 52 | * 5. Free the parser with ghostty_osc_free() when done | |
| 53 | * | |
| 54 | * @{ | |
| 55 | */ | |
| 56 | ||
| 57 | /** | |
| 58 | * OSC command types. | |
| 59 | * | |
| 60 | * @ingroup osc | |
| 61 | */ | |
| 62 | typedef enum { | |
| 63 | GHOSTTY_OSC_COMMAND_INVALID = 0, | |
| 64 | GHOSTTY_OSC_COMMAND_CHANGE_WINDOW_TITLE = 1, | |
| 65 | GHOSTTY_OSC_COMMAND_CHANGE_WINDOW_ICON = 2, | |
| 66 | GHOSTTY_OSC_COMMAND_SEMANTIC_PROMPT = 3, | |
| 67 | GHOSTTY_OSC_COMMAND_CLIPBOARD_CONTENTS = 4, | |
| 68 | GHOSTTY_OSC_COMMAND_REPORT_PWD = 5, | |
| 69 | GHOSTTY_OSC_COMMAND_MOUSE_SHAPE = 6, | |
| 70 | GHOSTTY_OSC_COMMAND_COLOR_OPERATION = 7, | |
| 71 | GHOSTTY_OSC_COMMAND_KITTY_COLOR_PROTOCOL = 8, | |
| 72 | GHOSTTY_OSC_COMMAND_SHOW_DESKTOP_NOTIFICATION = 9, | |
| 73 | GHOSTTY_OSC_COMMAND_HYPERLINK_START = 10, | |
| 74 | GHOSTTY_OSC_COMMAND_HYPERLINK_END = 11, | |
| 75 | GHOSTTY_OSC_COMMAND_CONEMU_SLEEP = 12, | |
| 76 | GHOSTTY_OSC_COMMAND_CONEMU_SHOW_MESSAGE_BOX = 13, | |
| 77 | GHOSTTY_OSC_COMMAND_CONEMU_CHANGE_TAB_TITLE = 14, | |
| 78 | GHOSTTY_OSC_COMMAND_CONEMU_PROGRESS_REPORT = 15, | |
| 79 | GHOSTTY_OSC_COMMAND_CONEMU_WAIT_INPUT = 16, | |
| 80 | GHOSTTY_OSC_COMMAND_CONEMU_GUIMACRO = 17, | |
| 81 | GHOSTTY_OSC_COMMAND_CONEMU_RUN_PROCESS = 18, | |
| 82 | GHOSTTY_OSC_COMMAND_CONEMU_OUTPUT_ENVIRONMENT_VARIABLE = 19, | |
| 83 | GHOSTTY_OSC_COMMAND_CONEMU_XTERM_EMULATION = 20, | |
| 84 | GHOSTTY_OSC_COMMAND_CONEMU_COMMENT = 21, | |
| 85 | GHOSTTY_OSC_COMMAND_KITTY_TEXT_SIZING = 22, | |
| 86 | } GhosttyOscCommandType; | |
| 87 | ||
| 88 | /** | |
| 89 | * OSC command data types. | |
| 90 | * | |
| 91 | * These values specify what type of data to extract from an OSC command | |
| 92 | * using `ghostty_osc_command_data`. | |
| 93 | * | |
| 94 | * @ingroup osc | |
| 95 | */ | |
| 96 | typedef enum { | |
| 97 | /** Invalid data type. Never results in any data extraction. */ | |
| 98 | GHOSTTY_OSC_DATA_INVALID = 0, | |
| 99 | ||
| 100 | /** | |
| 101 | * Window title string data. | |
| 102 | * | |
| 103 | * Valid for: GHOSTTY_OSC_COMMAND_CHANGE_WINDOW_TITLE | |
| 104 | * | |
| 105 | * Output type: const char ** (pointer to null-terminated string) | |
| 106 | * | |
| 107 | * Lifetime: Valid until the next call to any ghostty_osc_* function with | |
| 108 | * the same parser instance. Memory is owned by the parser. | |
| 109 | */ | |
| 110 | GHOSTTY_OSC_DATA_CHANGE_WINDOW_TITLE_STR = 1, | |
| 111 | } GhosttyOscCommandData; | |
| 112 | ||
| 113 | /** | |
| 114 | * Create a new OSC parser instance. | |
| 115 | * | |
| 116 | * Creates a new OSC (Operating System Command) parser using the provided | |
| 117 | * allocator. The parser must be freed using ghostty_vt_osc_free() when | |
| 118 | * no longer needed. | |
| 119 | * | |
| 120 | * @param allocator Pointer to the allocator to use for memory management, or NULL to use the default allocator | |
| 121 | * @param parser Pointer to store the created parser handle | |
| 122 | * @return GHOSTTY_SUCCESS on success, or an error code on failure | |
| 123 | * | |
| 124 | * @ingroup osc | |
| 125 | */ | |
| 126 | GhosttyResult ghostty_osc_new(const GhosttyAllocator *allocator, GhosttyOscParser *parser); | |
| 127 | ||
| 128 | /** | |
| 129 | * Free an OSC parser instance. | |
| 130 | * | |
| 131 | * Releases all resources associated with the OSC parser. After this call, | |
| 132 | * the parser handle becomes invalid and must not be used. | |
| 133 | * | |
| 134 | * @param parser The parser handle to free (may be NULL) | |
| 135 | * | |
| 136 | * @ingroup osc | |
| 137 | */ | |
| 138 | void ghostty_osc_free(GhosttyOscParser parser); | |
| 139 | ||
| 140 | /** | |
| 141 | * Reset an OSC parser instance to its initial state. | |
| 142 | * | |
| 143 | * Resets the parser state, clearing any partially parsed OSC sequences | |
| 144 | * and returning the parser to its initial state. This is useful for | |
| 145 | * reusing a parser instance or recovering from parse errors. | |
| 146 | * | |
| 147 | * @param parser The parser handle to reset, must not be null. | |
| 148 | * | |
| 149 | * @ingroup osc | |
| 150 | */ | |
| 151 | void ghostty_osc_reset(GhosttyOscParser parser); | |
| 152 | ||
| 153 | /** | |
| 154 | * Parse the next byte in an OSC sequence. | |
| 155 | * | |
| 156 | * Processes a single byte as part of an OSC sequence. The parser maintains | |
| 157 | * internal state to track the progress through the sequence. Call this | |
| 158 | * function for each byte in the sequence data. | |
| 159 | * | |
| 160 | * When finished pumping the parser with bytes, call ghostty_osc_end | |
| 161 | * to get the final result. | |
| 162 | * | |
| 163 | * @param parser The parser handle, must not be null. | |
| 164 | * @param byte The next byte to parse | |
| 165 | * | |
| 166 | * @ingroup osc | |
| 167 | */ | |
| 168 | void ghostty_osc_next(GhosttyOscParser parser, uint8_t byte); | |
| 169 | ||
| 170 | /** | |
| 171 | * Finalize OSC parsing and retrieve the parsed command. | |
| 172 | * | |
| 173 | * Call this function after feeding all bytes of an OSC sequence to the parser | |
| 174 | * using ghostty_osc_next() with the exception of the terminating character | |
| 175 | * (ESC or ST). This function finalizes the parsing process and returns the | |
| 176 | * parsed OSC command. | |
| 177 | * | |
| 178 | * The return value is never NULL. Invalid commands will return a command | |
| 179 | * with type GHOSTTY_OSC_COMMAND_INVALID. | |
| 180 | * | |
| 181 | * The terminator parameter specifies the byte that terminated the OSC sequence | |
| 182 | * (typically 0x07 for BEL or 0x5C for ST after ESC). This information is | |
| 183 | * preserved in the parsed command so that responses can use the same terminator | |
| 184 | * format for better compatibility with the calling program. For commands that | |
| 185 | * do not require a response, this parameter is ignored and the resulting | |
| 186 | * command will not retain the terminator information. | |
| 187 | * | |
| 188 | * The returned command handle is valid until the next call to any | |
| 189 | * `ghostty_osc_*` function with the same parser instance with the exception | |
| 190 | * of command introspection functions such as `ghostty_osc_command_type`. | |
| 191 | * | |
| 192 | * @param parser The parser handle, must not be null. | |
| 193 | * @param terminator The terminating byte of the OSC sequence (0x07 for BEL, 0x5C for ST) | |
| 194 | * @return Handle to the parsed OSC command | |
| 195 | * | |
| 196 | * @ingroup osc | |
| 197 | */ | |
| 198 | GhosttyOscCommand ghostty_osc_end(GhosttyOscParser parser, uint8_t terminator); | |
| 199 | ||
| 200 | /** | |
| 201 | * Get the type of an OSC command. | |
| 202 | * | |
| 203 | * Returns the type identifier for the given OSC command. This can be used | |
| 204 | * to determine what kind of command was parsed and what data might be | |
| 205 | * available from it. | |
| 206 | * | |
| 207 | * @param command The OSC command handle to query (may be NULL) | |
| 208 | * @return The command type, or GHOSTTY_OSC_COMMAND_INVALID if command is NULL | |
| 209 | * | |
| 210 | * @ingroup osc | |
| 211 | */ | |
| 212 | GhosttyOscCommandType ghostty_osc_command_type(GhosttyOscCommand command); | |
| 213 | ||
| 214 | /** | |
| 215 | * Extract data from an OSC command. | |
| 216 | * | |
| 217 | * Extracts typed data from the given OSC command based on the specified | |
| 218 | * data type. The output pointer must be of the appropriate type for the | |
| 219 | * requested data kind. Valid command types, output types, and memory | |
| 220 | * safety information are documented in the `GhosttyOscCommandData` enum. | |
| 221 | * | |
| 222 | * @param command The OSC command handle to query (may be NULL) | |
| 223 | * @param data The type of data to extract | |
| 224 | * @param out Pointer to store the extracted data (type depends on data parameter) | |
| 225 | * @return true if data extraction was successful, false otherwise | |
| 226 | * | |
| 227 | * @ingroup osc | |
| 228 | */ | |
| 229 | bool ghostty_osc_command_data(GhosttyOscCommand command, GhosttyOscCommandData data, void *out); | |
| 230 | ||
| 231 | /** @} */ | |
| 232 | ||
| 233 | #endif /* GHOSTTY_VT_OSC_H */ |
apps/mobile/modules/t3-terminal/Vendor/libghostty/GhosttyKit.xcframework/ios-arm64/Headers/ghostty/vt/paste.h deleted-75| ... | ... | @@ -1,75 +0,0 @@ |
| 1 | /** | |
| 2 | * @file paste.h | |
| 3 | * | |
| 4 | * Paste utilities - validate and encode paste data for terminal input. | |
| 5 | */ | |
| 6 | ||
| 7 | #ifndef GHOSTTY_VT_PASTE_H | |
| 8 | #define GHOSTTY_VT_PASTE_H | |
| 9 | ||
| 10 | /** @defgroup paste Paste Utilities | |
| 11 | * | |
| 12 | * Utilities for validating paste data safety. | |
| 13 | * | |
| 14 | * ## Basic Usage | |
| 15 | * | |
| 16 | * Use ghostty_paste_is_safe() to check if paste data contains potentially | |
| 17 | * dangerous sequences before sending it to the terminal. | |
| 18 | * | |
| 19 | * ## Example | |
| 20 | * | |
| 21 | * @code{.c} | |
| 22 | * #include <stdio.h> | |
| 23 | * #include <string.h> | |
| 24 | * #include <ghostty/vt.h> | |
| 25 | * | |
| 26 | * int main() { | |
| 27 | * const char* safe_data = "hello world"; | |
| 28 | * const char* unsafe_data = "rm -rf /\n"; | |
| 29 | * | |
| 30 | * if (ghostty_paste_is_safe(safe_data, strlen(safe_data))) { | |
| 31 | * printf("Safe to paste\n"); | |
| 32 | * } | |
| 33 | * | |
| 34 | * if (!ghostty_paste_is_safe(unsafe_data, strlen(unsafe_data))) { | |
| 35 | * printf("Unsafe! Contains newline\n"); | |
| 36 | * } | |
| 37 | * | |
| 38 | * return 0; | |
| 39 | * } | |
| 40 | * @endcode | |
| 41 | * | |
| 42 | * @{ | |
| 43 | */ | |
| 44 | ||
| 45 | #include <stdbool.h> | |
| 46 | #include <stddef.h> | |
| 47 | ||
| 48 | #ifdef __cplusplus | |
| 49 | extern "C" { | |
| 50 | #endif | |
| 51 | ||
| 52 | /** | |
| 53 | * Check if paste data is safe to paste into the terminal. | |
| 54 | * | |
| 55 | * Data is considered unsafe if it contains: | |
| 56 | * - Newlines (`\n`) which can inject commands | |
| 57 | * - The bracketed paste end sequence (`\x1b[201~`) which can be used | |
| 58 | * to exit bracketed paste mode and inject commands | |
| 59 | * | |
| 60 | * This check is conservative and considers data unsafe regardless of | |
| 61 | * current terminal state. | |
| 62 | * | |
| 63 | * @param data The paste data to check (must not be NULL) | |
| 64 | * @param len The length of the data in bytes | |
| 65 | * @return true if the data is safe to paste, false otherwise | |
| 66 | */ | |
| 67 | bool ghostty_paste_is_safe(const char* data, size_t len); | |
| 68 | ||
| 69 | #ifdef __cplusplus | |
| 70 | } | |
| 71 | #endif | |
| 72 | ||
| 73 | /** @} */ | |
| 74 | ||
| 75 | #endif /* GHOSTTY_VT_PASTE_H */ |
apps/mobile/modules/t3-terminal/Vendor/libghostty/GhosttyKit.xcframework/ios-arm64/Headers/ghostty/vt/result.h deleted-22| ... | ... | @@ -1,22 +0,0 @@ |
| 1 | /** | |
| 2 | * @file result.h | |
| 3 | * | |
| 4 | * Result codes for libghostty-vt operations. | |
| 5 | */ | |
| 6 | ||
| 7 | #ifndef GHOSTTY_VT_RESULT_H | |
| 8 | #define GHOSTTY_VT_RESULT_H | |
| 9 | ||
| 10 | /** | |
| 11 | * Result codes for libghostty-vt operations. | |
| 12 | */ | |
| 13 | typedef enum { | |
| 14 | /** Operation completed successfully */ | |
| 15 | GHOSTTY_SUCCESS = 0, | |
| 16 | /** Operation failed due to failed allocation */ | |
| 17 | GHOSTTY_OUT_OF_MEMORY = -1, | |
| 18 | /** Operation failed due to invalid value */ | |
| 19 | GHOSTTY_INVALID_VALUE = -2, | |
| 20 | } GhosttyResult; | |
| 21 | ||
| 22 | #endif /* GHOSTTY_VT_RESULT_H */ |
apps/mobile/modules/t3-terminal/Vendor/libghostty/GhosttyKit.xcframework/ios-arm64/Headers/ghostty/vt/sgr.h deleted-394| ... | ... | @@ -1,394 +0,0 @@ |
| 1 | /** | |
| 2 | * @file sgr.h | |
| 3 | * | |
| 4 | * SGR (Select Graphic Rendition) attribute parsing and handling. | |
| 5 | */ | |
| 6 | ||
| 7 | #ifndef GHOSTTY_VT_SGR_H | |
| 8 | #define GHOSTTY_VT_SGR_H | |
| 9 | ||
| 10 | /** @defgroup sgr SGR Parser | |
| 11 | * | |
| 12 | * SGR (Select Graphic Rendition) attribute parser. | |
| 13 | * | |
| 14 | * SGR sequences are the syntax used to set styling attributes such as | |
| 15 | * bold, italic, underline, and colors for text in terminal emulators. | |
| 16 | * For example, you may be familiar with sequences like `ESC[1;31m`. The | |
| 17 | * `1;31` is the SGR attribute list. | |
| 18 | * | |
| 19 | * The parser processes SGR parameters from CSI sequences (e.g., `ESC[1;31m`) | |
| 20 | * and returns individual text attributes like bold, italic, colors, etc. | |
| 21 | * It supports both semicolon (`;`) and colon (`:`) separators, possibly mixed, | |
| 22 | * and handles various color formats including 8-color, 16-color, 256-color, | |
| 23 | * X11 named colors, and RGB in multiple formats. | |
| 24 | * | |
| 25 | * ## Basic Usage | |
| 26 | * | |
| 27 | * 1. Create a parser instance with ghostty_sgr_new() | |
| 28 | * 2. Set SGR parameters with ghostty_sgr_set_params() | |
| 29 | * 3. Iterate through attributes using ghostty_sgr_next() | |
| 30 | * 4. Free the parser with ghostty_sgr_free() when done | |
| 31 | * | |
| 32 | * ## Example | |
| 33 | * | |
| 34 | * @code{.c} | |
| 35 | * #include <assert.h> | |
| 36 | * #include <stdio.h> | |
| 37 | * #include <ghostty/vt.h> | |
| 38 | * | |
| 39 | * int main() { | |
| 40 | * // Create parser | |
| 41 | * GhosttySgrParser parser; | |
| 42 | * GhosttyResult result = ghostty_sgr_new(NULL, &parser); | |
| 43 | * assert(result == GHOSTTY_SUCCESS); | |
| 44 | * | |
| 45 | * // Parse "bold, red foreground" sequence: ESC[1;31m | |
| 46 | * uint16_t params[] = {1, 31}; | |
| 47 | * result = ghostty_sgr_set_params(parser, params, NULL, 2); | |
| 48 | * assert(result == GHOSTTY_SUCCESS); | |
| 49 | * | |
| 50 | * // Iterate through attributes | |
| 51 | * GhosttySgrAttribute attr; | |
| 52 | * while (ghostty_sgr_next(parser, &attr)) { | |
| 53 | * switch (attr.tag) { | |
| 54 | * case GHOSTTY_SGR_ATTR_BOLD: | |
| 55 | * printf("Bold enabled\n"); | |
| 56 | * break; | |
| 57 | * case GHOSTTY_SGR_ATTR_FG_8: | |
| 58 | * printf("Foreground color: %d\n", attr.value.fg_8); | |
| 59 | * break; | |
| 60 | * default: | |
| 61 | * break; | |
| 62 | * } | |
| 63 | * } | |
| 64 | * | |
| 65 | * // Cleanup | |
| 66 | * ghostty_sgr_free(parser); | |
| 67 | * return 0; | |
| 68 | * } | |
| 69 | * @endcode | |
| 70 | * | |
| 71 | * @{ | |
| 72 | */ | |
| 73 | ||
| 74 | #include <ghostty/vt/allocator.h> | |
| 75 | #include <ghostty/vt/color.h> | |
| 76 | #include <ghostty/vt/result.h> | |
| 77 | #include <stdbool.h> | |
| 78 | #include <stddef.h> | |
| 79 | #include <stdint.h> | |
| 80 | ||
| 81 | #ifdef __cplusplus | |
| 82 | extern "C" { | |
| 83 | #endif | |
| 84 | ||
| 85 | /** | |
| 86 | * Opaque handle to an SGR parser instance. | |
| 87 | * | |
| 88 | * This handle represents an SGR (Select Graphic Rendition) parser that can | |
| 89 | * be used to parse SGR sequences and extract individual text attributes. | |
| 90 | * | |
| 91 | * @ingroup sgr | |
| 92 | */ | |
| 93 | typedef struct GhosttySgrParser* GhosttySgrParser; | |
| 94 | ||
| 95 | /** | |
| 96 | * SGR attribute tags. | |
| 97 | * | |
| 98 | * These values identify the type of an SGR attribute in a tagged union. | |
| 99 | * Use the tag to determine which field in the attribute value union to access. | |
| 100 | * | |
| 101 | * @ingroup sgr | |
| 102 | */ | |
| 103 | typedef enum { | |
| 104 | GHOSTTY_SGR_ATTR_UNSET = 0, | |
| 105 | GHOSTTY_SGR_ATTR_UNKNOWN = 1, | |
| 106 | GHOSTTY_SGR_ATTR_BOLD = 2, | |
| 107 | GHOSTTY_SGR_ATTR_RESET_BOLD = 3, | |
| 108 | GHOSTTY_SGR_ATTR_ITALIC = 4, | |
| 109 | GHOSTTY_SGR_ATTR_RESET_ITALIC = 5, | |
| 110 | GHOSTTY_SGR_ATTR_FAINT = 6, | |
| 111 | GHOSTTY_SGR_ATTR_UNDERLINE = 7, | |
| 112 | GHOSTTY_SGR_ATTR_RESET_UNDERLINE = 8, | |
| 113 | GHOSTTY_SGR_ATTR_UNDERLINE_COLOR = 9, | |
| 114 | GHOSTTY_SGR_ATTR_UNDERLINE_COLOR_256 = 10, | |
| 115 | GHOSTTY_SGR_ATTR_RESET_UNDERLINE_COLOR = 11, | |
| 116 | GHOSTTY_SGR_ATTR_OVERLINE = 12, | |
| 117 | GHOSTTY_SGR_ATTR_RESET_OVERLINE = 13, | |
| 118 | GHOSTTY_SGR_ATTR_BLINK = 14, | |
| 119 | GHOSTTY_SGR_ATTR_RESET_BLINK = 15, | |
| 120 | GHOSTTY_SGR_ATTR_INVERSE = 16, | |
| 121 | GHOSTTY_SGR_ATTR_RESET_INVERSE = 17, | |
| 122 | GHOSTTY_SGR_ATTR_INVISIBLE = 18, | |
| 123 | GHOSTTY_SGR_ATTR_RESET_INVISIBLE = 19, | |
| 124 | GHOSTTY_SGR_ATTR_STRIKETHROUGH = 20, | |
| 125 | GHOSTTY_SGR_ATTR_RESET_STRIKETHROUGH = 21, | |
| 126 | GHOSTTY_SGR_ATTR_DIRECT_COLOR_FG = 22, | |
| 127 | GHOSTTY_SGR_ATTR_DIRECT_COLOR_BG = 23, | |
| 128 | GHOSTTY_SGR_ATTR_BG_8 = 24, | |
| 129 | GHOSTTY_SGR_ATTR_FG_8 = 25, | |
| 130 | GHOSTTY_SGR_ATTR_RESET_FG = 26, | |
| 131 | GHOSTTY_SGR_ATTR_RESET_BG = 27, | |
| 132 | GHOSTTY_SGR_ATTR_BRIGHT_BG_8 = 28, | |
| 133 | GHOSTTY_SGR_ATTR_BRIGHT_FG_8 = 29, | |
| 134 | GHOSTTY_SGR_ATTR_BG_256 = 30, | |
| 135 | GHOSTTY_SGR_ATTR_FG_256 = 31, | |
| 136 | } GhosttySgrAttributeTag; | |
| 137 | ||
| 138 | /** | |
| 139 | * Underline style types. | |
| 140 | * | |
| 141 | * @ingroup sgr | |
| 142 | */ | |
| 143 | typedef enum { | |
| 144 | GHOSTTY_SGR_UNDERLINE_NONE = 0, | |
| 145 | GHOSTTY_SGR_UNDERLINE_SINGLE = 1, | |
| 146 | GHOSTTY_SGR_UNDERLINE_DOUBLE = 2, | |
| 147 | GHOSTTY_SGR_UNDERLINE_CURLY = 3, | |
| 148 | GHOSTTY_SGR_UNDERLINE_DOTTED = 4, | |
| 149 | GHOSTTY_SGR_UNDERLINE_DASHED = 5, | |
| 150 | } GhosttySgrUnderline; | |
| 151 | ||
| 152 | /** | |
| 153 | * Unknown SGR attribute data. | |
| 154 | * | |
| 155 | * Contains the full parameter list and the partial list where parsing | |
| 156 | * encountered an unknown or invalid sequence. | |
| 157 | * | |
| 158 | * @ingroup sgr | |
| 159 | */ | |
| 160 | typedef struct { | |
| 161 | const uint16_t* full_ptr; | |
| 162 | size_t full_len; | |
| 163 | const uint16_t* partial_ptr; | |
| 164 | size_t partial_len; | |
| 165 | } GhosttySgrUnknown; | |
| 166 | ||
| 167 | /** | |
| 168 | * SGR attribute value union. | |
| 169 | * | |
| 170 | * This union contains all possible attribute values. Use the tag field | |
| 171 | * to determine which union member is active. Attributes without associated | |
| 172 | * data (like bold, italic) don't use the union value. | |
| 173 | * | |
| 174 | * @ingroup sgr | |
| 175 | */ | |
| 176 | typedef union { | |
| 177 | GhosttySgrUnknown unknown; | |
| 178 | GhosttySgrUnderline underline; | |
| 179 | GhosttyColorRgb underline_color; | |
| 180 | GhosttyColorPaletteIndex underline_color_256; | |
| 181 | GhosttyColorRgb direct_color_fg; | |
| 182 | GhosttyColorRgb direct_color_bg; | |
| 183 | GhosttyColorPaletteIndex bg_8; | |
| 184 | GhosttyColorPaletteIndex fg_8; | |
| 185 | GhosttyColorPaletteIndex bright_bg_8; | |
| 186 | GhosttyColorPaletteIndex bright_fg_8; | |
| 187 | GhosttyColorPaletteIndex bg_256; | |
| 188 | GhosttyColorPaletteIndex fg_256; | |
| 189 | uint64_t _padding[8]; | |
| 190 | } GhosttySgrAttributeValue; | |
| 191 | ||
| 192 | /** | |
| 193 | * SGR attribute (tagged union). | |
| 194 | * | |
| 195 | * A complete SGR attribute with both its type tag and associated value. | |
| 196 | * Always check the tag field to determine which value union member is valid. | |
| 197 | * | |
| 198 | * Attributes without associated data (e.g., GHOSTTY_SGR_ATTR_BOLD) can be | |
| 199 | * identified by tag alone; the value union is not used for these and | |
| 200 | * the memory in the value field is undefined. | |
| 201 | * | |
| 202 | * @ingroup sgr | |
| 203 | */ | |
| 204 | typedef struct { | |
| 205 | GhosttySgrAttributeTag tag; | |
| 206 | GhosttySgrAttributeValue value; | |
| 207 | } GhosttySgrAttribute; | |
| 208 | ||
| 209 | /** | |
| 210 | * Create a new SGR parser instance. | |
| 211 | * | |
| 212 | * Creates a new SGR (Select Graphic Rendition) parser using the provided | |
| 213 | * allocator. The parser must be freed using ghostty_sgr_free() when | |
| 214 | * no longer needed. | |
| 215 | * | |
| 216 | * @param allocator Pointer to the allocator to use for memory management, or | |
| 217 | * NULL to use the default allocator | |
| 218 | * @param parser Pointer to store the created parser handle | |
| 219 | * @return GHOSTTY_SUCCESS on success, or an error code on failure | |
| 220 | * | |
| 221 | * @ingroup sgr | |
| 222 | */ | |
| 223 | GhosttyResult ghostty_sgr_new(const GhosttyAllocator* allocator, | |
| 224 | GhosttySgrParser* parser); | |
| 225 | ||
| 226 | /** | |
| 227 | * Free an SGR parser instance. | |
| 228 | * | |
| 229 | * Releases all resources associated with the SGR parser. After this call, | |
| 230 | * the parser handle becomes invalid and must not be used. This includes | |
| 231 | * any attributes previously returned by ghostty_sgr_next(). | |
| 232 | * | |
| 233 | * @param parser The parser handle to free (may be NULL) | |
| 234 | * | |
| 235 | * @ingroup sgr | |
| 236 | */ | |
| 237 | void ghostty_sgr_free(GhosttySgrParser parser); | |
| 238 | ||
| 239 | /** | |
| 240 | * Reset an SGR parser instance to the beginning of the parameter list. | |
| 241 | * | |
| 242 | * Resets the parser's iteration state without clearing the parameters. | |
| 243 | * After calling this, ghostty_sgr_next() will start from the beginning | |
| 244 | * of the parameter list again. | |
| 245 | * | |
| 246 | * @param parser The parser handle to reset, must not be NULL | |
| 247 | * | |
| 248 | * @ingroup sgr | |
| 249 | */ | |
| 250 | void ghostty_sgr_reset(GhosttySgrParser parser); | |
| 251 | ||
| 252 | /** | |
| 253 | * Set SGR parameters for parsing. | |
| 254 | * | |
| 255 | * Sets the SGR parameter list to parse. Parameters are the numeric values | |
| 256 | * from a CSI SGR sequence (e.g., for `ESC[1;31m`, params would be {1, 31}). | |
| 257 | * | |
| 258 | * The separators array optionally specifies the separator type for each | |
| 259 | * parameter position. Each byte should be either ';' for semicolon or ':' | |
| 260 | * for colon. This is needed for certain color formats that use colon | |
| 261 | * separators (e.g., `ESC[4:3m` for curly underline). Any invalid separator | |
| 262 | * values are treated as semicolons. The separators array must have the same | |
| 263 | * length as the params array, if it is not NULL. | |
| 264 | * | |
| 265 | * If separators is NULL, all parameters are assumed to be semicolon-separated. | |
| 266 | * | |
| 267 | * This function makes an internal copy of the parameter and separator data, | |
| 268 | * so the caller can safely free or modify the input arrays after this call. | |
| 269 | * | |
| 270 | * After calling this function, the parser is automatically reset and ready | |
| 271 | * to iterate from the beginning. | |
| 272 | * | |
| 273 | * @param parser The parser handle, must not be NULL | |
| 274 | * @param params Array of SGR parameter values | |
| 275 | * @param separators Optional array of separator characters (';' or ':'), or | |
| 276 | * NULL | |
| 277 | * @param len Number of parameters (and separators if provided) | |
| 278 | * @return GHOSTTY_SUCCESS on success, or an error code on failure | |
| 279 | * | |
| 280 | * @ingroup sgr | |
| 281 | */ | |
| 282 | GhosttyResult ghostty_sgr_set_params(GhosttySgrParser parser, | |
| 283 | const uint16_t* params, | |
| 284 | const char* separators, | |
| 285 | size_t len); | |
| 286 | ||
| 287 | /** | |
| 288 | * Get the next SGR attribute. | |
| 289 | * | |
| 290 | * Parses and returns the next attribute from the parameter list. | |
| 291 | * Call this function repeatedly until it returns false to process | |
| 292 | * all attributes in the sequence. | |
| 293 | * | |
| 294 | * @param parser The parser handle, must not be NULL | |
| 295 | * @param attr Pointer to store the next attribute | |
| 296 | * @return true if an attribute was returned, false if no more attributes | |
| 297 | * | |
| 298 | * @ingroup sgr | |
| 299 | */ | |
| 300 | bool ghostty_sgr_next(GhosttySgrParser parser, GhosttySgrAttribute* attr); | |
| 301 | ||
| 302 | /** | |
| 303 | * Get the full parameter list from an unknown SGR attribute. | |
| 304 | * | |
| 305 | * This function retrieves the full parameter list that was provided to the | |
| 306 | * parser when an unknown attribute was encountered. Primarily useful in | |
| 307 | * WebAssembly environments where accessing struct fields directly is difficult. | |
| 308 | * | |
| 309 | * @param unknown The unknown attribute data | |
| 310 | * @param ptr Pointer to store the pointer to the parameter array (may be NULL) | |
| 311 | * @return The length of the full parameter array | |
| 312 | * | |
| 313 | * @ingroup sgr | |
| 314 | */ | |
| 315 | size_t ghostty_sgr_unknown_full(GhosttySgrUnknown unknown, | |
| 316 | const uint16_t** ptr); | |
| 317 | ||
| 318 | /** | |
| 319 | * Get the partial parameter list from an unknown SGR attribute. | |
| 320 | * | |
| 321 | * This function retrieves the partial parameter list where parsing stopped | |
| 322 | * when an unknown attribute was encountered. Primarily useful in WebAssembly | |
| 323 | * environments where accessing struct fields directly is difficult. | |
| 324 | * | |
| 325 | * @param unknown The unknown attribute data | |
| 326 | * @param ptr Pointer to store the pointer to the parameter array (may be NULL) | |
| 327 | * @return The length of the partial parameter array | |
| 328 | * | |
| 329 | * @ingroup sgr | |
| 330 | */ | |
| 331 | size_t ghostty_sgr_unknown_partial(GhosttySgrUnknown unknown, | |
| 332 | const uint16_t** ptr); | |
| 333 | ||
| 334 | /** | |
| 335 | * Get the tag from an SGR attribute. | |
| 336 | * | |
| 337 | * This function extracts the tag that identifies which type of attribute | |
| 338 | * this is. Primarily useful in WebAssembly environments where accessing | |
| 339 | * struct fields directly is difficult. | |
| 340 | * | |
| 341 | * @param attr The SGR attribute | |
| 342 | * @return The attribute tag | |
| 343 | * | |
| 344 | * @ingroup sgr | |
| 345 | */ | |
| 346 | GhosttySgrAttributeTag ghostty_sgr_attribute_tag(GhosttySgrAttribute attr); | |
| 347 | ||
| 348 | /** | |
| 349 | * Get the value from an SGR attribute. | |
| 350 | * | |
| 351 | * This function returns a pointer to the value union from an SGR attribute. Use | |
| 352 | * the tag to determine which field of the union is valid. Primarily useful in | |
| 353 | * WebAssembly environments where accessing struct fields directly is difficult. | |
| 354 | * | |
| 355 | * @param attr Pointer to the SGR attribute | |
| 356 | * @return Pointer to the attribute value union | |
| 357 | * | |
| 358 | * @ingroup sgr | |
| 359 | */ | |
| 360 | GhosttySgrAttributeValue* ghostty_sgr_attribute_value( | |
| 361 | GhosttySgrAttribute* attr); | |
| 362 | ||
| 363 | #ifdef __wasm__ | |
| 364 | /** | |
| 365 | * Allocate memory for an SGR attribute (WebAssembly only). | |
| 366 | * | |
| 367 | * This is a convenience function for WebAssembly environments to allocate | |
| 368 | * memory for an SGR attribute structure that can be passed to ghostty_sgr_next. | |
| 369 | * | |
| 370 | * @return Pointer to the allocated attribute structure | |
| 371 | * | |
| 372 | * @ingroup wasm | |
| 373 | */ | |
| 374 | GhosttySgrAttribute* ghostty_wasm_alloc_sgr_attribute(void); | |
| 375 | ||
| 376 | /** | |
| 377 | * Free memory for an SGR attribute (WebAssembly only). | |
| 378 | * | |
| 379 | * Frees memory allocated by ghostty_wasm_alloc_sgr_attribute. | |
| 380 | * | |
| 381 | * @param attr Pointer to the attribute structure to free | |
| 382 | * | |
| 383 | * @ingroup wasm | |
| 384 | */ | |
| 385 | void ghostty_wasm_free_sgr_attribute(GhosttySgrAttribute* attr); | |
| 386 | #endif | |
| 387 | ||
| 388 | #ifdef __cplusplus | |
| 389 | } | |
| 390 | #endif | |
| 391 | ||
| 392 | /** @} */ | |
| 393 | ||
| 394 | #endif /* GHOSTTY_VT_SGR_H */ |
apps/mobile/modules/t3-terminal/Vendor/libghostty/GhosttyKit.xcframework/ios-arm64/Headers/ghostty/vt/wasm.h deleted-159| ... | ... | @@ -1,159 +0,0 @@ |
| 1 | /** | |
| 2 | * @file wasm.h | |
| 3 | * | |
| 4 | * WebAssembly utility functions for libghostty-vt. | |
| 5 | */ | |
| 6 | ||
| 7 | #ifndef GHOSTTY_VT_WASM_H | |
| 8 | #define GHOSTTY_VT_WASM_H | |
| 9 | ||
| 10 | #ifdef __wasm__ | |
| 11 | ||
| 12 | #include <stddef.h> | |
| 13 | #include <stdint.h> | |
| 14 | ||
| 15 | /** @defgroup wasm WebAssembly Utilities | |
| 16 | * | |
| 17 | * Convenience functions for allocating various types in WebAssembly builds. | |
| 18 | * **These are only available the libghostty-vt wasm module.** | |
| 19 | * | |
| 20 | * Ghostty relies on pointers to various types for ABI compatibility, and | |
| 21 | * creating those pointers in Wasm can be tedious. These functions provide | |
| 22 | * a purely additive set of utilities that simplify memory management in | |
| 23 | * Wasm environments without changing the core C library API. | |
| 24 | * | |
| 25 | * @note These functions always use the default allocator. If you need | |
| 26 | * custom allocation strategies, you should allocate types manually using | |
| 27 | * your custom allocator. This is a very rare use case in the WebAssembly | |
| 28 | * world so these are optimized for simplicity. | |
| 29 | * | |
| 30 | * ## Example Usage | |
| 31 | * | |
| 32 | * Here's a simple example of using the Wasm utilities with the key encoder: | |
| 33 | * | |
| 34 | * @code | |
| 35 | * const { exports } = wasmInstance; | |
| 36 | * const view = new DataView(wasmMemory.buffer); | |
| 37 | * | |
| 38 | * // Create key encoder | |
| 39 | * const encoderPtr = exports.ghostty_wasm_alloc_opaque(); | |
| 40 | * exports.ghostty_key_encoder_new(null, encoderPtr); | |
| 41 | * const encoder = view.getUint32(encoder, true); | |
| 42 | * | |
| 43 | * // Configure encoder with Kitty protocol flags | |
| 44 | * const flagsPtr = exports.ghostty_wasm_alloc_u8(); | |
| 45 | * view.setUint8(flagsPtr, 0x1F); | |
| 46 | * exports.ghostty_key_encoder_setopt(encoder, 5, flagsPtr); | |
| 47 | * | |
| 48 | * // Allocate output buffer and size pointer | |
| 49 | * const bufferSize = 32; | |
| 50 | * const bufPtr = exports.ghostty_wasm_alloc_u8_array(bufferSize); | |
| 51 | * const writtenPtr = exports.ghostty_wasm_alloc_usize(); | |
| 52 | * | |
| 53 | * // Encode the key event | |
| 54 | * exports.ghostty_key_encoder_encode( | |
| 55 | * encoder, eventPtr, bufPtr, bufferSize, writtenPtr | |
| 56 | * ); | |
| 57 | * | |
| 58 | * // Read encoded output | |
| 59 | * const bytesWritten = view.getUint32(writtenPtr, true); | |
| 60 | * const encoded = new Uint8Array(wasmMemory.buffer, bufPtr, bytesWritten); | |
| 61 | * @endcode | |
| 62 | * | |
| 63 | * @remark The code above is pretty ugly! This is the lowest level interface | |
| 64 | * to the libghostty-vt Wasm module. In practice, this should be wrapped | |
| 65 | * in a higher-level API that abstracts away all this. | |
| 66 | * | |
| 67 | * @{ | |
| 68 | */ | |
| 69 | ||
| 70 | /** | |
| 71 | * Allocate an opaque pointer. This can be used for any opaque pointer | |
| 72 | * types such as GhosttyKeyEncoder, GhosttyKeyEvent, etc. | |
| 73 | * | |
| 74 | * @return Pointer to allocated opaque pointer, or NULL if allocation failed | |
| 75 | * @ingroup wasm | |
| 76 | */ | |
| 77 | void** ghostty_wasm_alloc_opaque(void); | |
| 78 | ||
| 79 | /** | |
| 80 | * Free an opaque pointer allocated by ghostty_wasm_alloc_opaque(). | |
| 81 | * | |
| 82 | * @param ptr Pointer to free, or NULL (NULL is safely ignored) | |
| 83 | * @ingroup wasm | |
| 84 | */ | |
| 85 | void ghostty_wasm_free_opaque(void **ptr); | |
| 86 | ||
| 87 | /** | |
| 88 | * Allocate an array of uint8_t values. | |
| 89 | * | |
| 90 | * @param len Number of uint8_t elements to allocate | |
| 91 | * @return Pointer to allocated array, or NULL if allocation failed | |
| 92 | * @ingroup wasm | |
| 93 | */ | |
| 94 | uint8_t* ghostty_wasm_alloc_u8_array(size_t len); | |
| 95 | ||
| 96 | /** | |
| 97 | * Free an array allocated by ghostty_wasm_alloc_u8_array(). | |
| 98 | * | |
| 99 | * @param ptr Pointer to the array to free, or NULL (NULL is safely ignored) | |
| 100 | * @param len Length of the array (must match the length passed to alloc) | |
| 101 | * @ingroup wasm | |
| 102 | */ | |
| 103 | void ghostty_wasm_free_u8_array(uint8_t *ptr, size_t len); | |
| 104 | ||
| 105 | /** | |
| 106 | * Allocate an array of uint16_t values. | |
| 107 | * | |
| 108 | * @param len Number of uint16_t elements to allocate | |
| 109 | * @return Pointer to allocated array, or NULL if allocation failed | |
| 110 | * @ingroup wasm | |
| 111 | */ | |
| 112 | uint16_t* ghostty_wasm_alloc_u16_array(size_t len); | |
| 113 | ||
| 114 | /** | |
| 115 | * Free an array allocated by ghostty_wasm_alloc_u16_array(). | |
| 116 | * | |
| 117 | * @param ptr Pointer to the array to free, or NULL (NULL is safely ignored) | |
| 118 | * @param len Length of the array (must match the length passed to alloc) | |
| 119 | * @ingroup wasm | |
| 120 | */ | |
| 121 | void ghostty_wasm_free_u16_array(uint16_t *ptr, size_t len); | |
| 122 | ||
| 123 | /** | |
| 124 | * Allocate a single uint8_t value. | |
| 125 | * | |
| 126 | * @return Pointer to allocated uint8_t, or NULL if allocation failed | |
| 127 | * @ingroup wasm | |
| 128 | */ | |
| 129 | uint8_t* ghostty_wasm_alloc_u8(void); | |
| 130 | ||
| 131 | /** | |
| 132 | * Free a uint8_t allocated by ghostty_wasm_alloc_u8(). | |
| 133 | * | |
| 134 | * @param ptr Pointer to free, or NULL (NULL is safely ignored) | |
| 135 | * @ingroup wasm | |
| 136 | */ | |
| 137 | void ghostty_wasm_free_u8(uint8_t *ptr); | |
| 138 | ||
| 139 | /** | |
| 140 | * Allocate a single size_t value. | |
| 141 | * | |
| 142 | * @return Pointer to allocated size_t, or NULL if allocation failed | |
| 143 | * @ingroup wasm | |
| 144 | */ | |
| 145 | size_t* ghostty_wasm_alloc_usize(void); | |
| 146 | ||
| 147 | /** | |
| 148 | * Free a size_t allocated by ghostty_wasm_alloc_usize(). | |
| 149 | * | |
| 150 | * @param ptr Pointer to free, or NULL (NULL is safely ignored) | |
| 151 | * @ingroup wasm | |
| 152 | */ | |
| 153 | void ghostty_wasm_free_usize(size_t *ptr); | |
| 154 | ||
| 155 | /** @} */ | |
| 156 | ||
| 157 | #endif /* __wasm__ */ | |
| 158 | ||
| 159 | #endif /* GHOSTTY_VT_WASM_H */ |
apps/mobile/modules/t3-terminal/Vendor/libghostty/GhosttyKit.xcframework/ios-arm64/libghostty-fat.a| Binary files a/apps/mobile/modules/t3-terminal/Vendor/libghostty/GhosttyKit.xcframework/ios-arm64/libghostty-fat.a and b/apps/mobile/modules/t3-terminal/Vendor/libghostty/GhosttyKit.xcframework/ios-arm64/libghostty-fat.a differ |
apps/mobile/modules/t3-terminal/Vendor/libghostty/VERSION+1-1| ... | ... | @@ -1 +1 @@ |
| 1 | d36c3b8dffd0d756dd5e5f4933962f774a0e6753 | |
| 1 | cf8edc23f3a6a87a96e41a90013e89e987d34980 |
apps/mobile/modules/t3-terminal/ios/T3TerminalView.swift+1-1| ... | ... | @@ -459,7 +459,7 @@ public final class T3TerminalView: ExpoView, UITextFieldDelegate { |
| 459 | 459 | supports_selection_clipboard: false, |
| 460 | 460 | wakeup_cb: { _ in }, |
| 461 | 461 | action_cb: { _, _, _ in false }, |
| 462 | read_clipboard_cb: { _, _, _ in false }, | |
| 462 | read_clipboard_cb: { _, _, _, _, _, _ in GHOSTTY_CLIPBOARD_READ_UNSUPPORTED }, | |
| 463 | 463 | confirm_read_clipboard_cb: { _, _, _, _ in }, |
| 464 | 464 | write_clipboard_cb: { _, _, _, _, _ in }, |
| 465 | 465 | close_surface_cb: { _, _ in } |
apps/mobile/modules/t3-terminal/scripts/build-libghostty-ios16.sh+6-3| ... | ... | @@ -7,7 +7,7 @@ MODULE_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)" |
| 7 | 7 | VENDOR_DIR="${MODULE_DIR}/Vendor/libghostty" |
| 8 | 8 | |
| 9 | 9 | GHOSTTY_SOURCE_DIR="${GHOSTTY_SOURCE_DIR:-${HOME}/ghostty}" |
| 10 | GHOSTTY_ZIG_VERSION="${GHOSTTY_ZIG_VERSION:-0.15.2}" | |
| 10 | GHOSTTY_ZIG_VERSION="${GHOSTTY_ZIG_VERSION:-0.16.0}" | |
| 11 | 11 | GHOSTTY_ZIG="${GHOSTTY_ZIG:-}" |
| 12 | 12 | |
| 13 | 13 | log() { |
| ... | ... | @@ -86,8 +86,8 @@ log "building GhosttyKit.xcframework" |
| 86 | 86 | ) |
| 87 | 87 | |
| 88 | 88 | xcframework="${GHOSTTY_SOURCE_DIR}/macos/GhosttyKit.xcframework" |
| 89 | ios_archive="${xcframework}/ios-arm64/libghostty-fat.a" | |
| 90 | sim_archive="${xcframework}/ios-arm64-simulator/libghostty-fat.a" | |
| 89 | ios_archive="${xcframework}/ios-arm64/libghostty-internal.a" | |
| 90 | sim_archive="${xcframework}/ios-arm64-simulator/libghostty-internal.a" | |
| 91 | 91 | [[ -f "${ios_archive}" ]] || die "missing built iOS archive: ${ios_archive}" |
| 92 | 92 | [[ -f "${sim_archive}" ]] || die "missing built iOS simulator archive: ${sim_archive}" |
| 93 | 93 | |
| ... | ... | @@ -102,5 +102,8 @@ rsync -a --delete "${xcframework}/ios-arm64/Headers/" \ |
| 102 | 102 | "${VENDOR_DIR}/GhosttyKit.xcframework/ios-arm64/Headers/" |
| 103 | 103 | rsync -a --delete "${xcframework}/ios-arm64-simulator/Headers/" \ |
| 104 | 104 | "${VENDOR_DIR}/GhosttyKit.xcframework/ios-arm64-simulator/Headers/" |
| 105 | sed -i '' -e 's/[[:space:]]*$//' \ | |
| 106 | "${VENDOR_DIR}/GhosttyKit.xcframework/ios-arm64/Headers/ghostty.h" \ | |
| 107 | "${VENDOR_DIR}/GhosttyKit.xcframework/ios-arm64-simulator/Headers/ghostty.h" | |
| 105 | 108 | |
| 106 | 109 | log "done" |