From 0a5e570b0f97dbd339e5ef870197fd8aa4d1f7d1 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Sun, 3 Sep 2023 21:52:35 +1000 Subject: [PATCH] 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 --- lib-menu.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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", ""); -- 2.39.5