version 1.61, 2009/07/28 06:48:44 |
version 1.62, 2009/07/28 07:03:32 |
|
|
char pass[PASS_MAX]; |
char pass[PASS_MAX]; |
}; |
}; |
|
|
/* Editing keys. */ |
/* Mode key commands. */ |
enum mode_key_cmd { |
enum mode_key_cmd { |
MODEKEY_NONE, |
MODEKEY_NONE, |
MODEKEY_OTHER, |
MODEKEY_OTHER, |
|
|
MODEKEYCOPY_UP, |
MODEKEYCOPY_UP, |
}; |
}; |
|
|
|
/* Entry in the default mode key tables. */ |
struct mode_key_entry { |
struct mode_key_entry { |
int key; |
int key; |
|
|
|
|
* keys to be bound in edit mode. |
* keys to be bound in edit mode. |
*/ |
*/ |
int mode; |
int mode; |
|
|
enum mode_key_cmd cmd; |
enum mode_key_cmd cmd; |
}; |
}; |
|
|
|
/* Data required while mode keys are in use. */ |
struct mode_key_data { |
struct mode_key_data { |
const struct mode_key_entry *table; |
struct mode_key_tree *tree; |
int mode; |
int mode; |
}; |
}; |
#define MODEKEY_EMACS 0 |
#define MODEKEY_EMACS 0 |
#define MODEKEY_VI 1 |
#define MODEKEY_VI 1 |
|
|
|
/* Binding between a key and a command. */ |
|
struct mode_key_binding { |
|
int key; |
|
|
|
int mode; |
|
enum mode_key_cmd cmd; |
|
|
|
SPLAY_ENTRY(mode_key_binding) entry; |
|
}; |
|
SPLAY_HEAD(mode_key_tree, mode_key_binding); |
|
|
|
/* Command to string mapping. */ |
|
struct mode_key_cmdstr { |
|
enum mode_key_cmd cmd; |
|
const char *name; |
|
}; |
|
|
|
/* Named mode key table description. */ |
|
struct mode_key_table { |
|
const char *name; |
|
struct mode_key_cmdstr *cmdstr; |
|
struct mode_key_tree *tree; |
|
const struct mode_key_entry *table; /* default entries */ |
|
}; |
|
|
/* Modes. */ |
/* Modes. */ |
#define MODE_CURSOR 0x1 |
#define MODE_CURSOR 0x1 |
#define MODE_INSERT 0x2 |
#define MODE_INSERT 0x2 |
|
|
int load_cfg(const char *, char **x); |
int load_cfg(const char *, char **x); |
|
|
/* mode-key.c */ |
/* mode-key.c */ |
extern const struct mode_key_entry mode_key_vi_edit[]; |
extern const struct mode_key_table mode_key_tables[]; |
extern const struct mode_key_entry mode_key_vi_choice[]; |
extern struct mode_key_tree mode_key_tree_vi_edit; |
extern const struct mode_key_entry mode_key_vi_copy[]; |
extern struct mode_key_tree mode_key_tree_vi_choice; |
extern const struct mode_key_entry mode_key_emacs_edit[]; |
extern struct mode_key_tree mode_key_tree_vi_copy; |
extern const struct mode_key_entry mode_key_emacs_choice[]; |
extern struct mode_key_tree mode_key_tree_emacs_edit; |
extern const struct mode_key_entry mode_key_emacs_copy[]; |
extern struct mode_key_tree mode_key_tree_emacs_choice; |
void mode_key_init( |
extern struct mode_key_tree mode_key_tree_emacs_copy; |
struct mode_key_data *, const struct mode_key_entry *); |
int mode_key_cmp(struct mode_key_binding *, struct mode_key_binding *); |
|
SPLAY_PROTOTYPE(mode_key_tree, mode_key_binding, entry, mode_key_cmp); |
|
const char *mode_key_tostring(struct mode_key_cmdstr *r, enum mode_key_cmd); |
|
void mode_key_init_trees(void); |
|
void mode_key_free_trees(void); |
|
void mode_key_init(struct mode_key_data *, struct mode_key_tree *); |
enum mode_key_cmd mode_key_lookup(struct mode_key_data *, int); |
enum mode_key_cmd mode_key_lookup(struct mode_key_data *, int); |
|
|
/* options.c */ |
/* options.c */ |