]> git.ozlabs.org Git - petitboot/commitdiff
ui/ncurses: Don't use menu offsets for user item numbers
authorJeremy Kerr <jk@ozlabs.org>
Thu, 10 Apr 2014 03:16:23 +0000 (11:16 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Thu, 10 Apr 2014 03:17:42 +0000 (11:17 +0800)
The menu offsets are arbitrary, use a separate numbering scheme for user
items.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
ui/ncurses/nc-cui.c

index fce1752f04edab8c796464596cc0e8130ac711e9..e8aaf9aba37079589eb9b2e7da9062e7d0d2e8ed 100644 (file)
@@ -161,6 +161,7 @@ static void cui_boot_editor_on_exit(struct cui *cui,
 {
        struct pmenu *menu = cui->main;
        struct cui_opt_data *cod;
+       static int user_idx = 0;
 
        /* Was the edit cancelled? */
        if (!bd) {
@@ -184,7 +185,7 @@ static void cui_boot_editor_on_exit(struct cui *cui,
                item->on_execute = cui_boot;
                item->data = cod = talloc_zero(item, struct cui_opt_data);
 
-               cod->name = talloc_asprintf(cod, "User item %u:", insert_pt);
+               cod->name = talloc_asprintf(cod, "User item %u:", ++user_idx);
                if (pmenu_item_setup(menu, item, insert_pt,
                                talloc_strdup(item, cod->name)) == NULL) {
                        talloc_free(item);