summaryrefslogtreecommitdiff
path: root/src/keys.c
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2014-07-18 10:25:54 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2014-07-18 10:26:36 +0200
commit919a40f5612b5b2ce91284de337da17d6161edad (patch)
treee2ddbcd01c49256bb0eec615635d1a9c1366eff7 /src/keys.c
parent035faa883b980a8b7ec13794d7e02e95cfdc663b (diff)
downloadcalcurse-919a40f5612b5b2ce91284de337da17d6161edad.zip
Use wins_set_bindings() for the configuration menu
Make use of the general key binding context switching implementation for the configuration main menu. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/keys.c')
-rw-r--r--src/keys.c47
1 files changed, 41 insertions, 6 deletions
diff --git a/src/keys.c b/src/keys.c
index 34e6c10..6d4c6f9 100644
--- a/src/keys.c
+++ b/src/keys.c
@@ -443,16 +443,51 @@ keys_display_bindings_bar(WINDOW * win, int *bindings, int count,
else
binding_key = KEY_GENERIC_OTHER_CMD;
- strncpy(key, keys_action_firstkey(binding_key),
- KEYS_KEYLEN);
- key[KEYS_KEYLEN] = '\0';
- fmtkey = keys_format_label(key, KEYS_KEYLEN);
+ const char *label;
+
+ if (binding_key < NBKEYS) {
+ strncpy(key, keys_action_firstkey(binding_key),
+ KEYS_KEYLEN);
+ key[KEYS_KEYLEN] = '\0';
+ label = gettext(keydef[binding_key].sb_label);
+ } else {
+ switch (binding_key) {
+ case KEY_CONFIGMENU_GENERAL:
+ strcpy(key, "g");
+ label = _("General");
+ break;
+ case KEY_CONFIGMENU_LAYOUT:
+ strcpy(key, "l");
+ label = _("Layout");
+ break;
+ case KEY_CONFIGMENU_SIDEBAR:
+ strcpy(key, "s");
+ label = _("Sidebar");
+ break;
+ case KEY_CONFIGMENU_COLOR:
+ strcpy(key, "c");
+ label = _("Color");
+ break;
+ case KEY_CONFIGMENU_NOTIFY:
+ strcpy(key, "n");
+ label = _("Notify");
+ break;
+ case KEY_CONFIGMENU_KEYS:
+ strcpy(key, "k");
+ label = _("Keys");
+ break;
+ default:
+ strcpy(key, "?");
+ label = _("Unknown");
+ break;
+ }
+ }
custom_apply_attr(win, ATTR_HIGHEST);
+ fmtkey = keys_format_label(key, KEYS_KEYLEN);
mvwaddstr(win, key_pos_y, key_pos_x, fmtkey);
custom_remove_attr(win, ATTR_HIGHEST);
- mvwaddstr(win, label_pos_y, label_pos_x,
- gettext(keydef[binding_key].sb_label));
+ mvwaddstr(win, label_pos_y, label_pos_x, label);
}
wnoutrefresh(win);
}