X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;ds=sidebyside;f=config%2Fmenu.c;h=af66065733bb636be638d72c9fe4492692462d28;hb=208f6c0ba32f016890408ba55155be9de94c66f8;hp=7634d567e77949d2f7a71d05a5de8d9e96403500;hpb=8feb6085df8ac5f420533fba818aad40d0ff0e09;p=carl9170fw.git diff --git a/config/menu.c b/config/menu.c index 7634d56..af66065 100644 --- a/config/menu.c +++ b/config/menu.c @@ -323,6 +323,13 @@ void menu_finalize(struct menu *parent) if (menu->sym && menu->sym->type == S_UNKNOWN) menu_set_type(sym->type); } + + /* + * Use the choice itself as the parent dependency of + * the contained items. This turns the mode of the + * choice into an upper bound on the visibility of the + * choice value symbols. + */ parentdep = expr_alloc_symbol(sym); } else if (parent->prompt) parentdep = parent->prompt->visible.expr; @@ -525,6 +532,35 @@ void menu_finalize(struct menu *parent) *ep = expr_alloc_one(E_LIST, NULL); (*ep)->right.sym = menu->sym; } + + /* + * This code serves two purposes: + * + * (1) Flattening 'if' blocks, which do not specify a submenu + * and only add dependencies. + * + * (Automatic submenu creation might still create a submenu + * from an 'if' before this code runs.) + * + * (2) "Undoing" any automatic submenus created earlier below + * promptless symbols. + * + * Before: + * + * A + * if ... (or promptless symbol) + * +-B + * +-C + * D + * + * After: + * + * A + * if ... (or promptless symbol) + * B + * C + * D + */ if (menu->list && (!menu->prompt || !menu->prompt->text)) { for (last_menu = menu->list; ; last_menu = last_menu->next) { last_menu->parent = parent;