Line |
Branch |
Exec |
Source |
1 |
|
|
#ifndef MODE_H |
2 |
|
|
#define MODE_H |
3 |
|
|
|
4 |
|
|
#include <stdbool.h> |
5 |
|
|
#include "command/run.h" |
6 |
|
|
#include "terminal/key.h" |
7 |
|
|
#include "util/hashmap.h" |
8 |
|
|
#include "util/intmap.h" |
9 |
|
|
#include "util/macros.h" |
10 |
|
|
#include "util/ptr-array.h" |
11 |
|
|
|
12 |
|
|
typedef struct { |
13 |
|
|
const char *name; |
14 |
|
|
const CommandSet *cmds; |
15 |
|
|
IntMap key_bindings; |
16 |
|
|
bool insert_text_for_unicode_range; |
17 |
|
|
PointerArray fallthrough_modes; |
18 |
|
|
} ModeHandler; |
19 |
|
|
|
20 |
|
2 |
static inline ModeHandler *get_mode_handler(HashMap *modes, const char *name) |
21 |
|
|
{ |
22 |
|
2 |
return hashmap_get(modes, name); |
23 |
|
|
} |
24 |
|
|
|
25 |
|
|
struct EditorState; |
26 |
|
|
bool handle_input(struct EditorState *e, KeyCode key) NONNULL_ARGS; |
27 |
|
|
ModeHandler *new_mode(HashMap *modes, char *name, const CommandSet *cmds) NONNULL_ARGS_AND_RETURN; |
28 |
|
|
|
29 |
|
|
#endif |
30 |
|
|
|