summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 63dec68)
raw | patch | inline | side by side (parent: 63dec68)
author | Jonas Fonseca <fonseca@diku.dk> | |
Wed, 7 Jun 2006 23:52:50 +0000 (01:52 +0200) | ||
committer | Jonas Fonseca <fonseca@antimatter.localdomain> | |
Wed, 7 Jun 2006 23:52:50 +0000 (01:52 +0200) |
tig.c | patch | blob | history |
index 626fcd5fd1ca49e8dfc89d1ae29c09f5a0e10edd..708213edc2e103626e7a373fc8d16f1c6fc7a62c 100644 (file)
--- a/tig.c
+++ b/tig.c
* Keys
*/
-struct keymap {
+struct keybinding {
int alias;
- int request;
+ enum request request;
};
-static struct keymap keymap[] = {
+static struct keybinding default_keybindings[] = {
/* View switching */
{ 'm', REQ_VIEW_MAIN },
{ 'd', REQ_VIEW_DIFF },
};
static enum request
-get_request(int key)
+get_keybinding(int key)
{
int i;
- for (i = 0; i < ARRAY_SIZE(keymap); i++)
- if (keymap[i].alias == key)
- return keymap[i].request;
+ for (i = 0; i < ARRAY_SIZE(default_keybindings); i++)
+ if (default_keybindings[i].alias == key)
+ return default_keybindings[i].request;
return (enum request) key;
}
+
struct key {
char *name;
int value;
buf[pos] = 0;
- for (i = 0; i < ARRAY_SIZE(keymap); i++) {
+ for (i = 0; i < ARRAY_SIZE(default_keybindings); i++) {
+ struct keybinding *keybinding = &default_keybindings[i];
char *seq = NULL;
int key;
- if (keymap[i].request != request)
+ if (keybinding->request != request)
continue;
for (key = 0; key < ARRAY_SIZE(key_table); key++)
- if (key_table[key].value == keymap[i].alias)
+ if (key_table[key].value == keybinding->alias)
seq = key_table[key].name;
if (seq == NULL &&
- keymap[i].alias < 127 &&
- isprint(keymap[i].alias)) {
- key_char[1] = (char) keymap[i].alias;
+ keybinding->alias < 127 &&
+ isprint(keybinding->alias)) {
+ key_char[1] = (char) keybinding->alias;
seq = key_char;
}
/* Refresh, accept single keystroke of input */
key = wgetch(status_win);
- request = get_request(key);
+ request = get_keybinding(key);
/* Some low-level request handling. This keeps access to
* status_win restricted. */