diff --git a/src/keybind.c b/src/keybind.c
index 7917650..5599faf 100644
a
|
b
|
int lookup_action (char *keyname) |
711 | 711 | } |
712 | 712 | |
713 | 713 | void |
714 | | keymap_add(GArray *keymap, int key, int cmd) |
| 714 | keymap_add(GArray *keymap, int key, int cmd, char *caption) |
715 | 715 | { |
716 | 716 | global_key_map_t new_bind, *map; |
717 | 717 | map = &(g_array_index(keymap, global_key_map_t, 0)); |
… |
… |
keymap_add(GArray *keymap, int key, int cmd) |
719 | 719 | if (key !=0 && cmd !=0) { |
720 | 720 | new_bind.key = key; |
721 | 721 | new_bind.command = cmd; |
| 722 | new_bind.caption = g_strdup (caption); |
722 | 723 | g_array_append_val(keymap, new_bind); |
723 | 724 | } |
724 | 725 | |
… |
… |
keymap_add(GArray *keymap, int key, int cmd) |
727 | 728 | void |
728 | 729 | keybind_cmd_bind(GArray *keymap, char *keybind, int action) |
729 | 730 | { |
730 | | keymap_add(keymap, lookup_key(keybind), action); |
| 731 | char *caplion |
| 732 | int key = lookup_key(keybind, caplion); |
| 733 | keymap_add(keymap, lookup_key(keybind), action, caplion); |
| 734 | g_free (caplion); |
731 | 735 | } |
diff --git a/src/keybind.h b/src/keybind.h
index 7a36661..7ddb79d 100644
a
|
b
|
typedef struct key_config_t { |
20 | 20 | typedef struct global_key_map_t { |
21 | 21 | long key; |
22 | 22 | long command; |
| 23 | char *caption; |
23 | 24 | } global_key_map_t; |
24 | 25 | |
25 | 26 | int lookup_action (char *keyname); |
diff --git a/src/tty/key.c b/src/tty/key.c
index 5d000ce..0b91e94 100644
a
|
b
|
lookup_keyname (char *keyname) |
1249 | 1249 | |
1250 | 1250 | /* Return the code associated with the symbolic name keyname */ |
1251 | 1251 | int |
1252 | | lookup_key (char *keyname) |
| 1252 | lookup_key (char *keyname, char **label) |
1253 | 1253 | { |
1254 | 1254 | int k = -1; |
1255 | 1255 | char **keys; |
1256 | 1256 | guint keys_count = -1; |
1257 | 1257 | int key = 0; |
1258 | 1258 | int i = 0; |
1259 | | |
| 1259 | char buf[BUF_TINY]; |
| 1260 | int buf_pos = 0; |
| 1261 | char *p; |
1260 | 1262 | if (keyname == NULL) |
1261 | 1263 | return 0; |
1262 | 1264 | |
… |
… |
lookup_key (char *keyname) |
1269 | 1271 | |
1270 | 1272 | if (key & KEY_M_SHIFT) { |
1271 | 1273 | if (k < 127) { |
| 1274 | if (buf_pos > 0) |
| 1275 | buf[++buf_pos] = '-'; |
| 1276 | } |
| 1277 | buf[++buf_pos] = 'S'; |
1272 | 1278 | k = (gchar) g_ascii_toupper ((gchar) k); |
1273 | 1279 | continue; |
1274 | 1280 | } |
1275 | 1281 | } |
1276 | 1282 | if (key & KEY_M_CTRL) { |
| 1283 | if (buf_pos > 0) |
| 1284 | buf[++buf_pos] = '-'; |
| 1285 | } |
| 1286 | buf[++buf_pos] = 'C'; |
1277 | 1287 | if (k < 256) |
1278 | 1288 | k = XCTRL (k); |
1279 | 1289 | else |
… |
… |
lookup_key (char *keyname) |
1283 | 1293 | if (key < 127) |
1284 | 1294 | key = (gchar) g_ascii_tolower ((gchar) key); |
1285 | 1295 | k = key; |
1286 | | } else |
| 1296 | } else { |
| 1297 | buf[++buf_pos] = '-'; |
1287 | 1298 | k |= key; |
| 1299 | } |
| 1300 | |
| 1301 | for (p = keys[i]; *p; p++) |
| 1302 | buf[++buf_pos] = *p; |
| 1303 | buf[buf_pos] = '\0'; |
1288 | 1304 | } |
1289 | 1305 | } |
1290 | 1306 | } |
… |
… |
lookup_key (char *keyname) |
1292 | 1308 | if (k == -1) |
1293 | 1309 | return 0; |
1294 | 1310 | |
| 1311 | *label = g_strdup (buf); |
1295 | 1312 | return k; |
1296 | 1313 | } |
1297 | 1314 | |