kconfig: Create links to main menu items in search
When one searches for a main menu item, links aren't created for it like with the rest of the symbols. This happens because we trace the item until we get to the rootmenu, but we don't include it in the path of the item. The rationale was probably that we don't want to show the main menu in the path of all items, because it is redundant. However, when an item has only the rootmenu in its path it should be included, because this way the user can jump to its location. Add a 'Main menu' entry in the 'Location:' section for the kconfig items. This makes the 'if (i > 0)' superfluous because each item with prompt will have at least one menu in its path. Signed-off-by: Ariel Marcovitch <arielmarcovitch@gmail.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
This commit is contained in:
Родитель
90a353491e
Коммит
d05377e184
|
@ -728,7 +728,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
|
||||||
get_dep_str(r, prop->visible.expr, " Visible if: ");
|
get_dep_str(r, prop->visible.expr, " Visible if: ");
|
||||||
|
|
||||||
menu = prop->menu->parent;
|
menu = prop->menu->parent;
|
||||||
for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) {
|
for (i = 0; menu && i < 8; menu = menu->parent) {
|
||||||
bool accessible = menu_is_visible(menu);
|
bool accessible = menu_is_visible(menu);
|
||||||
|
|
||||||
submenu[i++] = menu;
|
submenu[i++] = menu;
|
||||||
|
@ -758,14 +758,18 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
|
||||||
list_add_tail(&jump->entries, head);
|
list_add_tail(&jump->entries, head);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i > 0) {
|
|
||||||
str_printf(r, " Location:\n");
|
str_printf(r, " Location:\n");
|
||||||
for (j = 4; --i >= 0; j += 2) {
|
for (j = 4; --i >= 0; j += 2) {
|
||||||
menu = submenu[i];
|
menu = submenu[i];
|
||||||
if (jump && menu == location)
|
if (jump && menu == location)
|
||||||
jump->offset = strlen(r->s);
|
jump->offset = strlen(r->s);
|
||||||
str_printf(r, "%*c-> %s", j, ' ',
|
|
||||||
menu_get_prompt(menu));
|
if (menu == &rootmenu)
|
||||||
|
/* The real rootmenu prompt is ugly */
|
||||||
|
str_printf(r, "%*cMain menu", j, ' ');
|
||||||
|
else
|
||||||
|
str_printf(r, "%*c-> %s", j, ' ', menu_get_prompt(menu));
|
||||||
|
|
||||||
if (menu->sym) {
|
if (menu->sym) {
|
||||||
str_printf(r, " (%s [=%s])", menu->sym->name ?
|
str_printf(r, " (%s [=%s])", menu->sym->name ?
|
||||||
menu->sym->name : "<choice>",
|
menu->sym->name : "<choice>",
|
||||||
|
@ -773,7 +777,6 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
|
||||||
}
|
}
|
||||||
str_append(r, "\n");
|
str_append(r, "\n");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_symbol_props_str(struct gstr *r, struct symbol *sym,
|
static void get_symbol_props_str(struct gstr *r, struct symbol *sym,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче