Files
neovim/src/nvim/tui/input.h
bfredl c13c50b752 refactor(io): separate types for read and write streams
This is a structural refactor with no logical changes, yet. Done in
preparation for simplifying rstream/rbuffer which will require more
state inline in RStream.

The initial idea was to have RStream and WStream as sub-types
symetrically but that doesn't work, as sockets are both reading and
writing. Also there is very little write-specific state to start with,
so the benefit of a separate WStream struct is a lot smaller. Just
document what fields in `Stream` are write specific.
2024-05-31 15:01:13 +02:00

50 lines
1.3 KiB
C

#pragma once
#include <stdbool.h>
#include <stdint.h>
#include <uv.h>
#include "nvim/event/defs.h"
#include "nvim/rbuffer_defs.h"
#include "nvim/tui/input_defs.h" // IWYU pragma: keep
#include "nvim/tui/tui_defs.h"
#include "nvim/types_defs.h"
#include "termkey/termkey.h"
typedef enum {
kKeyEncodingLegacy, ///< Legacy key encoding
kKeyEncodingKitty, ///< Kitty keyboard protocol encoding
kKeyEncodingXterm, ///< Xterm's modifyOtherKeys encoding (XTMODKEYS)
} KeyEncoding;
typedef struct {
int in_fd;
// Phases: -1=all 0=disabled 1=first-chunk 2=continue 3=last-chunk
int8_t paste;
bool ttimeout;
bool waiting_for_kkp_response; ///< True if we are expecting to receive a response to a query for
///< Kitty keyboard protocol support
KeyEncoding key_encoding; ///< The key encoding used by the terminal emulator
OptInt ttimeoutlen;
TermKey *tk;
TermKey_Terminfo_Getstr_Hook *tk_ti_hook_fn; ///< libtermkey terminfo hook
uv_timer_t timer_handle;
Loop *loop;
RStream read_stream;
RBuffer *key_buffer;
TUIData *tui_data;
} TermInput;
typedef enum {
kIncomplete = -1,
kNotApplicable = 0,
kComplete = 1,
} HandleState;
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "tui/input.h.generated.h"
#endif