getchar_defs.h (2132B)
1 #pragma once 2 3 #include <stdbool.h> 4 #include <stddef.h> 5 #include <stdint.h> 6 7 #include "nvim/api/private/defs.h" 8 9 /// structure used to store one block of the stuff/redo/recording buffers 10 typedef struct buffblock { 11 struct buffblock *b_next; ///< pointer to next buffblock 12 size_t b_strlen; ///< length of b_str, excluding the NUL 13 char b_str[1]; ///< contents (actually longer) 14 } buffblock_T; 15 16 /// header used for the stuff buffer and the redo buffer 17 typedef struct { 18 buffblock_T bh_first; ///< first (dummy) block of list 19 buffblock_T *bh_curr; ///< buffblock for appending 20 size_t bh_index; ///< index for reading 21 size_t bh_space; ///< space in bh_curr for appending 22 bool bh_create_newblock; ///< create a new block? 23 } buffheader_T; 24 25 typedef struct { 26 buffheader_T sr_redobuff; 27 buffheader_T sr_old_redobuff; 28 } save_redo_T; 29 30 /// Used for the typeahead buffer: typebuf. 31 typedef struct { 32 uint8_t *tb_buf; ///< buffer for typed characters 33 uint8_t *tb_noremap; ///< mapping flags for characters in tb_buf[] 34 int tb_buflen; ///< size of tb_buf[] 35 int tb_off; ///< current position in tb_buf[] 36 int tb_len; ///< number of valid bytes in tb_buf[] 37 int tb_maplen; ///< nr of mapped bytes in tb_buf[] 38 int tb_silent; ///< nr of silently mapped bytes in tb_buf[] 39 int tb_no_abbr_cnt; ///< nr of bytes without abbrev. in tb_buf[] 40 int tb_change_cnt; ///< nr of time tb_buf was changed; never zero 41 } typebuf_T; 42 43 /// Struct to hold the saved typeahead for save_typeahead(). 44 typedef struct { 45 typebuf_T save_typebuf; 46 bool typebuf_valid; ///< true when save_typebuf valid 47 int old_char; 48 int old_mod_mask; 49 buffheader_T save_readbuf1; 50 buffheader_T save_readbuf2; 51 String save_inputbuf; 52 } tasave_T; 53 54 /// Values for "noremap" argument of ins_typebuf() 55 /// 56 /// Also used for map->m_noremap and menu->noremap[]. 57 enum RemapValues { 58 REMAP_YES = 0, ///< Allow remapping. 59 REMAP_NONE = -1, ///< No remapping. 60 REMAP_SCRIPT = -2, ///< Remap script-local mappings only. 61 REMAP_SKIP = -3, ///< No remapping for first char. 62 };