]> git.ozlabs.org Git - petitboot/blobdiff - ui/ncurses/nc-config.c
ui/ncurses: Unify key bindings & key help text
[petitboot] / ui / ncurses / nc-config.c
index 8d68e7446499e700a16122c6726da68d6171ac98..64d0619b66c66703dc64c9d08c9b50e07dfc3903 100644 (file)
@@ -118,10 +118,23 @@ static void config_screen_process_key(struct nc_scr *scr, int key)
        bool handled;
 
        handled = widgetset_process_key(screen->widgetset, key);
+
+       if (!handled) {
+               switch (key) {
+               case 'x':
+               case 27: /* esc */
+                       screen->exit = true;
+                       break;
+               case 'h':
+                       screen->show_help = true;
+                       break;
+               }
+       }
+
        if (screen->exit) {
                screen->on_exit(screen->cui);
 
-       } else if (screen->show_help || (!handled && key == 'h')) {
+       } else if (screen->show_help) {
                screen->show_help = false;
                cui_show_help(screen->cui, "System Configuration",
                                config_help_text);
@@ -689,7 +702,7 @@ struct config_screen *config_screen_init(struct cui *cui,
                        "Petitboot System Configuration");
        screen->scr.frame.rtitle = NULL;
        screen->scr.frame.help = talloc_strdup(screen,
-                       "tab=next, shift+tab=previous");
+                       "tab=next, shift+tab=previous, x=exit, h=help");
        nc_scr_frame_draw(&screen->scr);
 
        scrollok(screen->scr.sub_ncw, true);