mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ariel Marcovitch <arielmarcovitch@gmail.com>
To: masahiroy@kernel.org
Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] kconfig: Create links to main menu items in search
Date: Fri, 24 Sep 2021 21:00:19 +0300	[thread overview]
Message-ID: <be481cb5-cfe0-6e23-2c27-c2e0aed69c6c@gmail.com> (raw)
In-Reply-To: <20210913164514.437972-1-arielmarcovitch@gmail.com>

On 13/09/2021 19:45, Ariel Marcovitch wrote:
> 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>
> ---
>   scripts/kconfig/menu.c | 33 ++++++++++++++++++---------------
>   1 file changed, 18 insertions(+), 15 deletions(-)
>
> diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
> index 606ba8a63c24..3d6f7cba8846 100644
> --- a/scripts/kconfig/menu.c
> +++ b/scripts/kconfig/menu.c
> @@ -728,7 +728,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
>   		get_dep_str(r, prop->visible.expr, "  Visible if: ");
>   
>   	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);
>   
>   		submenu[i++] = menu;
> @@ -758,21 +758,24 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
>   		list_add_tail(&jump->entries, head);
>   	}
>   
> -	if (i > 0) {
> -		str_printf(r, "  Location:\n");
> -		for (j = 4; --i >= 0; j += 2) {
> -			menu = submenu[i];
> -			if (jump && menu == location)
> -				jump->offset = strlen(r->s);
> -			str_printf(r, "%*c-> %s", j, ' ',
> -				   menu_get_prompt(menu));
> -			if (menu->sym) {
> -				str_printf(r, " (%s [=%s])", menu->sym->name ?
> -					menu->sym->name : "<choice>",
> -					sym_get_string_value(menu->sym));
> -			}
> -			str_append(r, "\n");
> +	str_printf(r, "  Location:\n");
> +	for (j = 4; --i >= 0; j += 2) {
> +		menu = submenu[i];
> +		if (jump && menu == location)
> +			jump->offset = strlen(r->s);
> +
> +		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) {
> +			str_printf(r, " (%s [=%s])", menu->sym->name ?
> +				menu->sym->name : "<choice>",
> +				sym_get_string_value(menu->sym));
>   		}
> +		str_append(r, "\n");
>   	}
>   }
>   
>
> base-commit: a9086b878b7fd65894eb8cb1fa395dd469970566
A friendly ping :)

  reply	other threads:[~2021-09-24 18:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-13 16:45 Ariel Marcovitch
2021-09-24 18:00 ` Ariel Marcovitch [this message]
2021-09-25  7:28   ` Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=be481cb5-cfe0-6e23-2c27-c2e0aed69c6c@gmail.com \
    --to=arielmarcovitch@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®