1 #ifndef NVIM_TUI_INPUT_H
2 #define NVIM_TUI_INPUT_H
3 
4 #include <stdbool.h>
5 #include <termkey.h>
6 
7 #include "nvim/event/stream.h"
8 #include "nvim/event/time.h"
9 
10 typedef struct term_input {
11   int in_fd;
12   // Phases: -1=all 0=disabled 1=first-chunk 2=continue 3=last-chunk
13   int8_t paste;
14   bool waiting;
15   bool ttimeout;
16   int8_t waiting_for_bg_response;
17   long ttimeoutlen;
18   TermKey *tk;
19 #if TERMKEY_VERSION_MAJOR > 0 || TERMKEY_VERSION_MINOR > 18
20   TermKey_Terminfo_Getstr_Hook *tk_ti_hook_fn;  ///< libtermkey terminfo hook
21 #endif
22   TimeWatcher timer_handle;
23   Loop *loop;
24   Stream read_stream;
25   RBuffer *key_buffer;
26   uv_mutex_t key_buffer_mutex;
27   uv_cond_t key_buffer_cond;
28 } TermInput;
29 
30 #ifdef INCLUDE_GENERATED_DECLARATIONS
31 # include "tui/input.h.generated.h"
32 #endif
33 
34 #ifdef UNIT_TESTING
35 typedef enum {
36   kIncomplete = -1,
37   kNotApplicable = 0,
38   kComplete = 1,
39 } HandleState;
40 
41 HandleState ut_handle_background_color(TermInput *input);
42 #endif
43 
44 #endif  // NVIM_TUI_INPUT_H
45