aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/tui/input.h
blob: 5df108b107a9c41084cfcb018df0b0c138b3d291 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef NVIM_TUI_INPUT_H
#define NVIM_TUI_INPUT_H

#include <stdbool.h>
#include <stdint.h>
#include <termkey.h>
#include <uv.h>

#include "nvim/event/loop.h"
#include "nvim/event/stream.h"
#include "nvim/event/time.h"
#include "nvim/rbuffer.h"
#include "nvim/tui/input_defs.h"
#include "nvim/tui/tui.h"

typedef enum {
  kExtkeysNone,
  kExtkeysCSIu,
  kExtkeysXterm,
} ExtkeysType;

typedef struct term_input {
  int in_fd;
  // Phases: -1=all 0=disabled 1=first-chunk 2=continue 3=last-chunk
  int8_t paste;
  bool waiting;
  bool ttimeout;
  int8_t waiting_for_bg_response;
  int8_t waiting_for_csiu_response;
  ExtkeysType extkeys_type;
  long ttimeoutlen;
  TermKey *tk;
  TermKey_Terminfo_Getstr_Hook *tk_ti_hook_fn;  ///< libtermkey terminfo hook
  TimeWatcher timer_handle;
  Loop *loop;
  Stream read_stream;
  RBuffer *key_buffer;
  uv_mutex_t key_buffer_mutex;
  uv_cond_t key_buffer_cond;
  TUIData *tui_data;
} TermInput;

#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "tui/input.h.generated.h"
#endif

#ifdef UNIT_TESTING
typedef enum {
  kIncomplete = -1,
  kNotApplicable = 0,
  kComplete = 1,
} HandleState;

HandleState ut_handle_background_color(TermInput *input);
#endif

#endif  // NVIM_TUI_INPUT_H