input.h (1252B)
1 #pragma once 2 3 #include <stdbool.h> 4 #include <stddef.h> 5 #include <stdint.h> 6 #include <uv.h> 7 8 #include "nvim/event/defs.h" 9 #include "nvim/tui/input_defs.h" // IWYU pragma: keep 10 #include "nvim/tui/termkey/termkey_defs.h" 11 #include "nvim/tui/tui_defs.h" 12 #include "nvim/types_defs.h" 13 14 typedef enum { 15 kKeyEncodingLegacy, ///< Legacy key encoding 16 kKeyEncodingKitty, ///< Kitty keyboard protocol encoding 17 kKeyEncodingXterm, ///< Xterm's modifyOtherKeys encoding (XTMODKEYS) 18 } KeyEncoding; 19 20 typedef struct { 21 void (*primary_device_attr)(TUIData *tui); 22 } TermInputCallbacks; 23 24 #define KEY_BUFFER_SIZE 0x1000 25 typedef struct { 26 int in_fd; 27 // Phases: -1=all 0=disabled 1=first-chunk 2=continue 3=last-chunk 28 int8_t paste; 29 bool ttimeout; 30 31 TermInputCallbacks callbacks; 32 33 KeyEncoding key_encoding; ///< The key encoding used by the terminal emulator 34 35 OptInt ttimeoutlen; 36 TermKey *tk; 37 TermKey_Terminfo_Getstr_Hook *tk_ti_hook_fn; ///< libtermkey terminfo hook 38 uv_timer_t timer_handle; 39 uv_timer_t bg_query_timer; ///< timer used to batch background color queries 40 Loop *loop; 41 RStream read_stream; 42 TUIData *tui_data; 43 char key_buffer[KEY_BUFFER_SIZE]; 44 size_t key_buffer_len; 45 } TermInput; 46 47 #include "tui/input.h.generated.h"