From: NeilBrown Date: Sun, 3 Sep 2023 11:52:35 +0000 (+1000) Subject: lib-menu: be more consistent in setting 'mode' of menu X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=0a5e570b0f97dbd339e5ef870197fd8aa4d1f7d1;p=edlib.git lib-menu: be more consistent in setting 'mode' of menu Rather than using the string of one mode flag and the num for another, use the string for all. Signed-off-by: NeilBrown --- diff --git a/lib-menu.c b/lib-menu.c index 5b0f17ba..ab21cb46 100644 --- a/lib-menu.c +++ b/lib-menu.c @@ -118,6 +118,10 @@ DEF_LOOKUP_CMD(menu_handle, menu_map); DEF_CMD(menu_attach) { + /* ->str gives the "mode" + * D means per-display menu, not per-pane + * V means show value in menu as well as name + */ struct pane *docp, *p, *p2; /* Multi-line temporary popup with x,y location provided. */ const char *mode = "Mtx"; @@ -133,11 +137,13 @@ DEF_CMD(menu_attach) call("doc:set:autoclose", docp, 1); attr_set_str(&docp->attrs, "render-simple", "format"); attr_set_str(&docp->attrs, "heading", ""); - if (ci->num & 1) + if (strchr(mmode, 'V')) /* show the 'action' - presumably a key name */ - attr_set_str(&docp->attrs, "line-format", "<%BG>%name%shortcut"); + attr_set_str(&docp->attrs, "line-format", + "<%BG>%name%shortcut"); else - attr_set_str(&docp->attrs, "line-format", "<%BG>%name"); + attr_set_str(&docp->attrs, "line-format", + "<%BG>%name"); attr_set_str(&docp->attrs, "done-key", ci->str2 ?: "menu-done"); /* No borders, just a shaded background to make menu stand out */ attr_set_str(&docp->attrs, "borders", "");