summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f40385a)
raw | patch | inline | side by side (parent: f40385a)
author | Jonas Fonseca <fonseca@diku.dk> | |
Tue, 9 Oct 2007 00:43:01 +0000 (02:43 +0200) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Tue, 9 Oct 2007 00:43:01 +0000 (02:43 +0200) |
It was factored out in the external command patch.
tig.c | patch | blob | history |
index 48eeb4dfaf2dba766b9d66c40946ed867b99d203..a3cebbf305803fb8108ddb86093401cac3943b2c 100644 (file)
--- a/tig.c
+++ b/tig.c
get_key(enum request request)
{
static char buf[BUFSIZ];
- static char key_char[] = "'X'";
size_t pos = 0;
char *sep = "";
int i;
for (i = 0; i < ARRAY_SIZE(default_keybindings); i++) {
struct keybinding *keybinding = &default_keybindings[i];
- char *seq = NULL;
- int key;
if (keybinding->request != request)
continue;
- for (key = 0; key < ARRAY_SIZE(key_table); key++)
- if (key_table[key].value == keybinding->alias)
- seq = key_table[key].name;
-
- if (seq == NULL &&
- keybinding->alias < 127 &&
- isprint(keybinding->alias)) {
- key_char[1] = (char) keybinding->alias;
- seq = key_char;
- }
-
- if (!seq)
- seq = "'?'";
-
- if (!string_format_from(buf, &pos, "%s%s", sep, seq))
+ if (!string_format_from(buf, &pos, "%s%s", sep,
+ get_key_name(keybinding->alias)))
return "Too many keybindings!";
sep = ", ";
}