X-Git-Url: https://jxself.org/git/?p=carl9170fw.git;a=blobdiff_plain;f=config%2Fmenu.c;h=dcf22008b2d6e4732d1e2785b0706395a8e1b071;hp=47bec3434fef16f1b0c46e0f8d908ee704aa57ca;hb=82b30c13e001113c9df51fcbfbde94bce1183d29;hpb=2f1132cbcec40e431991cda7ff3744455b46c3df diff --git a/config/menu.c b/config/menu.c index 47bec34..dcf2200 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; @@ -549,6 +556,15 @@ void menu_finalize(struct menu *parent) sym->flags |= SYMBOL_WARNED; } + /* + * For non-optional choices, add a reverse dependency (corresponding to + * a select) of ' && m'. This prevents the user from + * setting the choice mode to 'n' when the choice is visible. + * + * This would also work for non-choice symbols, but only non-optional + * choices clear SYMBOL_OPTIONAL as of writing. Choices are implemented + * as a type of symbol. + */ if (sym && !sym_is_optional(sym) && parent->prompt) { sym->rev_dep.expr = expr_alloc_or(sym->rev_dep.expr, expr_alloc_and(parent->prompt->visible.expr,