Commit ccd3fed5 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] fix menuconfig choice item help display

From: Bjorn Helgaas <bjorn.helgaas@hp.com>
      Anders Gustafsson <andersg@0x63.nu>
      Roman Zippel <zippel@linux-m68k.org>

This patch fixes menuconfig so it can display help text for individual
choice group config entries.

Previously it would only display the help text attached to the "choice"
item.  There was no way to display the help attached to individual config
entries inside the choice group.  Typically, the "choice" item has no help
text, and all the useful help is attached to the individual entries, so
this was a bit of a problem.
parent eb32911f
...@@ -607,6 +607,7 @@ static void conf_choice(struct menu *menu) ...@@ -607,6 +607,7 @@ static void conf_choice(struct menu *menu)
struct symbol *active; struct symbol *active;
int stat; int stat;
active = sym_get_choice_value(menu->sym);
while (1) { while (1) {
cprint_init(); cprint_init();
cprint("--title"); cprint("--title");
...@@ -618,24 +619,32 @@ static void conf_choice(struct menu *menu) ...@@ -618,24 +619,32 @@ static void conf_choice(struct menu *menu)
cprint("6"); cprint("6");
current_menu = menu; current_menu = menu;
active = sym_get_choice_value(menu->sym);
for (child = menu->list; child; child = child->next) { for (child = menu->list; child; child = child->next) {
if (!menu_is_visible(child)) if (!menu_is_visible(child))
continue; continue;
cprint("%p", child); cprint("%p", child);
cprint("%s", menu_get_prompt(child)); cprint("%s", menu_get_prompt(child));
cprint(child->sym == active ? "ON" : "OFF"); if (child->sym == sym_get_choice_value(menu->sym))
cprint("ON");
else if (child->sym == active)
cprint("SELECTED");
else
cprint("OFF");
} }
stat = exec_conf(); stat = exec_conf();
switch (stat) { switch (stat) {
case 0: case 0:
if (sscanf(input_buf, "%p", &menu) != 1) if (sscanf(input_buf, "%p", &child) != 1)
break; break;
sym_set_tristate_value(menu->sym, yes); sym_set_tristate_value(child->sym, yes);
return; return;
case 1: case 1:
show_help(menu); if (sscanf(input_buf, "%p", &child) == 1) {
show_help(child);
active = child->sym;
} else
show_help(menu);
break; break;
case 255: case 255:
return; return;
......
...@@ -138,9 +138,11 @@ dialog_checklist (const char *title, const char *prompt, int height, int width, ...@@ -138,9 +138,11 @@ dialog_checklist (const char *title, const char *prompt, int height, int width,
/* Initializes status */ /* Initializes status */
for (i = 0; i < item_no; i++) { for (i = 0; i < item_no; i++) {
status[i] = !strcasecmp (items[i * 3 + 2], "on"); status[i] = !strcasecmp (items[i * 3 + 2], "on");
if (!choice && status[i]) if ((!choice && status[i]) || !strcasecmp (items[i * 3 + 2], "selected"))
choice = i; choice = i + 1;
} }
if (choice)
choice--;
max_choice = MIN (list_height, item_no); max_choice = MIN (list_height, item_no);
...@@ -302,6 +304,7 @@ dialog_checklist (const char *title, const char *prompt, int height, int width, ...@@ -302,6 +304,7 @@ dialog_checklist (const char *title, const char *prompt, int height, int width,
case 'H': case 'H':
case 'h': case 'h':
case '?': case '?':
fprintf (stderr, "%s", items[(scroll + choice) * 3]);
delwin (dialog); delwin (dialog);
free (status); free (status);
return 1; return 1;
...@@ -347,7 +350,8 @@ dialog_checklist (const char *title, const char *prompt, int height, int width, ...@@ -347,7 +350,8 @@ dialog_checklist (const char *title, const char *prompt, int height, int width,
} }
} }
} } else
fprintf (stderr, "%s", items[(scroll + choice) * 3]);
delwin (dialog); delwin (dialog);
free (status); free (status);
return button; return button;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment