X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;ds=sidebyside;f=config%2Fmenu.c;fp=config%2Fmenu.c;h=af66065733bb636be638d72c9fe4492692462d28;hb=208f6c0ba32f016890408ba55155be9de94c66f8;hp=dcf22008b2d6e4732d1e2785b0706395a8e1b071;hpb=82b30c13e001113c9df51fcbfbde94bce1183d29;p=carl9170fw.git diff --git a/config/menu.c b/config/menu.c index dcf2200..af66065 100644 --- a/config/menu.c +++ b/config/menu.c @@ -532,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;