1 #ifndef NVIM_GETCHAR_H
2 #define NVIM_GETCHAR_H
3 
4 #include "nvim/buffer_defs.h"
5 #include "nvim/ex_cmds_defs.h"
6 #include "nvim/os/fileio.h"
7 #include "nvim/types.h"
8 #include "nvim/vim.h"
9 
10 /// Values for "noremap" argument of ins_typebuf()
11 ///
12 /// Also used for map->m_noremap and menu->noremap[].
13 enum RemapValues {
14   REMAP_YES = 0,  ///< Allow remapping.
15   REMAP_NONE = -1,  ///< No remapping.
16   REMAP_SCRIPT = -2,  ///< Remap script-local mappings only.
17   REMAP_SKIP = -3,  ///< No remapping for first char.
18 };
19 
20 // Argument for flush_buffers().
21 typedef enum {
22   FLUSH_MINIMAL,
23   FLUSH_TYPEAHEAD,  // flush current typebuf contents
24   FLUSH_INPUT,  // flush typebuf and inchar() input
25 } flush_buffers_T;
26 
27 /// All possible |:map-arguments| usable in a |:map| command.
28 ///
29 /// The <special> argument has no effect on mappings and is excluded from this
30 /// struct declaration. |noremap| is included, since it behaves like a map
31 /// argument when used in a mapping.
32 ///
33 /// @see mapblock_T
34 struct map_arguments {
35   bool buffer;
36   bool expr;
37   bool noremap;
38   bool nowait;
39   bool script;
40   bool silent;
41   bool unique;
42 
43   /// The {lhs} of the mapping.
44   ///
45   /// vim limits this to MAXMAPLEN characters, allowing us to use a static
46   /// buffer. Setting lhs_len to a value larger than MAXMAPLEN can signal
47   /// that {lhs} was too long and truncated.
48   char_u lhs[MAXMAPLEN + 1];
49   size_t lhs_len;
50 
51   char_u *rhs;  /// The {rhs} of the mapping.
52   size_t rhs_len;
53   bool rhs_is_noop;  /// True when the {orig_rhs} is <nop>.
54 
55   char_u *orig_rhs;  /// The original text of the {rhs}.
56   size_t orig_rhs_len;
57 };
58 typedef struct map_arguments MapArguments;
59 #define MAP_ARGUMENTS_INIT { false, false, false, false, false, false, false, \
60                              { 0 }, 0, NULL, 0, false, NULL, 0 }
61 
62 #define KEYLEN_PART_KEY -1  // keylen value for incomplete key-code
63 #define KEYLEN_PART_MAP -2  // keylen value for incomplete mapping
64 
65 /// Maximum number of streams to read script from
66 enum { NSCRIPT = 15, };
67 
68 /// Streams to read script from
69 extern FileDescriptor *scriptin[NSCRIPT];
70 
71 #ifdef INCLUDE_GENERATED_DECLARATIONS
72 # include "getchar.h.generated.h"
73 #endif
74 #endif  // NVIM_GETCHAR_H
75