diff mbox series

kconfig: menuconfig: Make hidden options show as dim

Message ID 20231228054630.3595093-1-tfiga@chromium.org (mailing list archive)
State New, archived
Headers show
Series kconfig: menuconfig: Make hidden options show as dim | expand

Commit Message

Tomasz Figa Dec. 28, 2023, 5:46 a.m. UTC
When hidden options are toggled on (using 'z'), the number of options
on the screen can be overwhelming and may make it hard to distinguish
between available and hidden ones. Make them easier to distinguish by
displaying the hidden one as dim (using the A_DIM curses attribute).

Signed-off-by: Tomasz Figa <tfiga@chromium.org>
---
 scripts/kconfig/lxdialog/dialog.h  |  3 +++
 scripts/kconfig/lxdialog/menubox.c | 11 +++++++----
 scripts/kconfig/lxdialog/util.c    | 10 ++++++++++
 scripts/kconfig/mconf.c            | 18 ++++++++++++++++++
 4 files changed, 38 insertions(+), 4 deletions(-)

Comments

Masahiro Yamada Dec. 28, 2023, 4:09 p.m. UTC | #1
On Thu, Dec 28, 2023 at 2:46 PM Tomasz Figa <tfiga@chromium.org> wrote:
>
> When hidden options are toggled on (using 'z'), the number of options
> on the screen can be overwhelming and may make it hard to distinguish
> between available and hidden ones. Make them easier to distinguish by
> displaying the hidden one as dim (using the A_DIM curses attribute).
>
> Signed-off-by: Tomasz Figa <tfiga@chromium.org>



Do you think this is useful?

This changes the color only when you select a hidden item.


For unselected items, you cannot distinguish hidden ones,
as A_DIM has no effect to black text.









> ---
>  scripts/kconfig/lxdialog/dialog.h  |  3 +++
>  scripts/kconfig/lxdialog/menubox.c | 11 +++++++----
>  scripts/kconfig/lxdialog/util.c    | 10 ++++++++++
>  scripts/kconfig/mconf.c            | 18 ++++++++++++++++++
>  4 files changed, 38 insertions(+), 4 deletions(-)
>
> diff --git a/scripts/kconfig/lxdialog/dialog.h b/scripts/kconfig/lxdialog/dialog.h
> index a501abf9fa31..d2ebdc6e2e28 100644
> --- a/scripts/kconfig/lxdialog/dialog.h
> +++ b/scripts/kconfig/lxdialog/dialog.h
> @@ -128,6 +128,7 @@ void item_add_str(const char *fmt, ...);
>  void item_set_tag(char tag);
>  void item_set_data(void *p);
>  void item_set_selected(int val);
> +void item_set_hidden(int val);
>  int item_activate_selected(void);
>  void *item_data(void);
>  char item_tag(void);
> @@ -139,6 +140,7 @@ struct dialog_item {
>         char tag;
>         void *data;     /* pointer to menu item - used by menubox+checklist */
>         int selected;   /* Set to 1 by dialog_*() function if selected. */
> +       int hidden;     /* Set to 1 if hidden. */
>  };
>
>  /* list of lialog_items */
> @@ -157,6 +159,7 @@ int item_n(void);
>  const char *item_str(void);
>  int item_is_selected(void);
>  int item_is_tag(char tag);
> +int item_is_hidden(void);
>  #define item_foreach() \
>         for (item_cur = item_head ? item_head: item_cur; \
>              item_cur && (item_cur != &item_nil); item_cur = item_cur->next)
> diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c
> index 0e333284e947..2cf1f24f67b6 100644
> --- a/scripts/kconfig/lxdialog/menubox.c
> +++ b/scripts/kconfig/lxdialog/menubox.c
> @@ -51,9 +51,9 @@ static int menu_width, item_x;
>   * Print menu item
>   */
>  static void do_print_item(WINDOW * win, const char *item, int line_y,
> -                         int selected, int hotkey)
> +                         int selected, int hotkey, int hidden)
>  {
> -       int j;
> +       int j, attrs;
>         char *menu_item = malloc(menu_width + 1);
>
>         strncpy(menu_item, item, menu_width - item_x);
> @@ -64,7 +64,10 @@ static void do_print_item(WINDOW * win, const char *item, int line_y,
>         wattrset(win, dlg.menubox.atr);
>         wmove(win, line_y, 0);
>         wclrtoeol(win);
> -       wattrset(win, selected ? dlg.item_selected.atr : dlg.item.atr);
> +       attrs = selected ? dlg.item_selected.atr : dlg.item.atr;
> +       if (hidden)
> +               attrs |= A_DIM;
> +       wattrset(win, attrs);
>         mvwaddstr(win, line_y, item_x, menu_item);
>         if (hotkey) {
>                 wattrset(win, selected ? dlg.tag_key_selected.atr
> @@ -81,7 +84,7 @@ static void do_print_item(WINDOW * win, const char *item, int line_y,
>  #define print_item(index, choice, selected)                            \
>  do {                                                                   \
>         item_set(index);                                                \
> -       do_print_item(menu, item_str(), choice, selected, !item_is_tag(':')); \
> +       do_print_item(menu, item_str(), choice, selected, !item_is_tag(':'), item_is_hidden()); \
>  } while (0)
>
>  /*
> diff --git a/scripts/kconfig/lxdialog/util.c b/scripts/kconfig/lxdialog/util.c
> index 3f78fb265136..58d6ee96f7ec 100644
> --- a/scripts/kconfig/lxdialog/util.c
> +++ b/scripts/kconfig/lxdialog/util.c
> @@ -635,6 +635,11 @@ void item_set_selected(int val)
>         item_cur->node.selected = val;
>  }
>
> +void item_set_hidden(int val)
> +{
> +       item_cur->node.hidden = val;
> +}
> +
>  int item_activate_selected(void)
>  {
>         item_foreach()
> @@ -698,3 +703,8 @@ int item_is_tag(char tag)
>  {
>         return (item_cur->node.tag == tag);
>  }
> +
> +int item_is_hidden(void)
> +{
> +       return (item_cur->node.hidden != 0);
> +}
> diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
> index eccc87a441e7..090121a1e5b6 100644
> --- a/scripts/kconfig/mconf.c
> +++ b/scripts/kconfig/mconf.c
> @@ -539,6 +539,8 @@ static void build_conf(struct menu *menu)
>                                                   menu_is_empty(menu) ? "----" : "--->");
>                                 item_set_tag('m');
>                                 item_set_data(menu);
> +                               if (!visible)
> +                                       item_set_hidden(TRUE);
>                                 if (single_menu_mode && menu->data)
>                                         goto conf_childs;
>                                 return;
> @@ -548,6 +550,8 @@ static void build_conf(struct menu *menu)
>                                         item_make("   %*c*** %s ***", indent + 1, ' ', prompt);
>                                         item_set_tag(':');
>                                         item_set_data(menu);
> +                                       if (!visible)
> +                                               item_set_hidden(TRUE);
>                                 }
>                                 break;
>                         default:
> @@ -556,6 +560,8 @@ static void build_conf(struct menu *menu)
>                                         item_make("---%*c%s", indent + 1, ' ', prompt);
>                                         item_set_tag(':');
>                                         item_set_data(menu);
> +                                       if (!visible)
> +                                               item_set_hidden(TRUE);
>                                 }
>                         }
>                 } else
> @@ -591,10 +597,14 @@ static void build_conf(struct menu *menu)
>                         }
>                         item_set_tag('t');
>                         item_set_data(menu);
> +                       if (!visible)
> +                               item_set_hidden(TRUE);
>                 } else {
>                         item_make("   ");
>                         item_set_tag(def_menu ? 't' : ':');
>                         item_set_data(menu);
> +                       if (!visible)
> +                               item_set_hidden(TRUE);
>                 }
>
>                 item_add_str("%*c%s", indent + 1, ' ', menu_get_prompt(menu));
> @@ -615,6 +625,8 @@ static void build_conf(struct menu *menu)
>                         item_make("---%*c%s", indent + 1, ' ', menu_get_prompt(menu));
>                         item_set_tag(':');
>                         item_set_data(menu);
> +                       if (!visible)
> +                               item_set_hidden(TRUE);
>                         goto conf_childs;
>                 }
>                 child_count++;
> @@ -632,6 +644,8 @@ static void build_conf(struct menu *menu)
>                                         item_make("-%c-", val == no ? ' ' : '*');
>                                 item_set_tag('t');
>                                 item_set_data(menu);
> +                               if (!visible)
> +                                       item_set_hidden(TRUE);
>                                 break;
>                         case S_TRISTATE:
>                                 switch (val) {
> @@ -648,6 +662,8 @@ static void build_conf(struct menu *menu)
>                                         item_make("-%c-", ch);
>                                 item_set_tag('t');
>                                 item_set_data(menu);
> +                               if (!visible)
> +                                       item_set_hidden(TRUE);
>                                 break;
>                         default:
>                                 tmp = 2 + strlen(sym_get_string_value(sym)); /* () = 2 */
> @@ -660,6 +676,8 @@ static void build_conf(struct menu *menu)
>                                              "" : " (NEW)");
>                                 item_set_tag('s');
>                                 item_set_data(menu);
> +                               if (!visible)
> +                                       item_set_hidden(TRUE);
>                                 goto conf_childs;
>                         }
>                 }
> --
> 2.43.0.472.g3155946c3a-goog
>
>
Tomasz Figa Jan. 10, 2024, 1:05 p.m. UTC | #2
On Fri, Dec 29, 2023 at 1:10 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> On Thu, Dec 28, 2023 at 2:46 PM Tomasz Figa <tfiga@chromium.org> wrote:
> >
> > When hidden options are toggled on (using 'z'), the number of options
> > on the screen can be overwhelming and may make it hard to distinguish
> > between available and hidden ones. Make them easier to distinguish by
> > displaying the hidden one as dim (using the A_DIM curses attribute).
> >
> > Signed-off-by: Tomasz Figa <tfiga@chromium.org>
>
>
>
> Do you think this is useful?
>
> This changes the color only when you select a hidden item.
>
>
> For unselected items, you cannot distinguish hidden ones,
> as A_DIM has no effect to black text.
>
>

Hmm, are you sure about that? For me it seems to dim the text. it
seems to be also used in the existing code for dlg.button_inactive.atr
of the mono theme:

https://elixir.bootlin.com/linux/latest/source/scripts/kconfig/lxdialog/util.c#L26

Best regards,
Tomasz
Masahiro Yamada Jan. 13, 2024, 11:22 a.m. UTC | #3
On Wed, Jan 10, 2024 at 10:05 PM Tomasz Figa <tfiga@chromium.org> wrote:
>
> On Fri, Dec 29, 2023 at 1:10 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
> >
> > On Thu, Dec 28, 2023 at 2:46 PM Tomasz Figa <tfiga@chromium.org> wrote:
> > >
> > > When hidden options are toggled on (using 'z'), the number of options
> > > on the screen can be overwhelming and may make it hard to distinguish
> > > between available and hidden ones. Make them easier to distinguish by
> > > displaying the hidden one as dim (using the A_DIM curses attribute).
> > >
> > > Signed-off-by: Tomasz Figa <tfiga@chromium.org>
> >
> >
> >
> > Do you think this is useful?
> >
> > This changes the color only when you select a hidden item.
> >
> >
> > For unselected items, you cannot distinguish hidden ones,
> > as A_DIM has no effect to black text.
> >
> >
>
> Hmm, are you sure about that? For me it seems to dim the text. it
> seems to be also used in the existing code for dlg.button_inactive.atr
> of the mono theme:
>
> https://elixir.bootlin.com/linux/latest/source/scripts/kconfig/lxdialog/util.c#L26



Then, your code works only on the mono theme.
(when your terminal does not support color, or
"MENUCONFIG_COLOR=mono make menuconfig")



In the normal color mode, the foreground text is black.
(Just like a picture in https://en.wikipedia.org/wiki/Menuconfig)
A_DIM does nothing for black.
Tomasz Figa Jan. 15, 2024, 5:04 a.m. UTC | #4
On Sat, Jan 13, 2024 at 8:23 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> On Wed, Jan 10, 2024 at 10:05 PM Tomasz Figa <tfiga@chromium.org> wrote:
> >
> > On Fri, Dec 29, 2023 at 1:10 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
> > >
> > > On Thu, Dec 28, 2023 at 2:46 PM Tomasz Figa <tfiga@chromium.org> wrote:
> > > >
> > > > When hidden options are toggled on (using 'z'), the number of options
> > > > on the screen can be overwhelming and may make it hard to distinguish
> > > > between available and hidden ones. Make them easier to distinguish by
> > > > displaying the hidden one as dim (using the A_DIM curses attribute).
> > > >
> > > > Signed-off-by: Tomasz Figa <tfiga@chromium.org>
> > >
> > >
> > >
> > > Do you think this is useful?
> > >
> > > This changes the color only when you select a hidden item.
> > >
> > >
> > > For unselected items, you cannot distinguish hidden ones,
> > > as A_DIM has no effect to black text.
> > >
> > >
> >
> > Hmm, are you sure about that? For me it seems to dim the text. it
> > seems to be also used in the existing code for dlg.button_inactive.atr
> > of the mono theme:
> >
> > https://elixir.bootlin.com/linux/latest/source/scripts/kconfig/lxdialog/util.c#L26
>
>
>
> Then, your code works only on the mono theme.
> (when your terminal does not support color, or
> "MENUCONFIG_COLOR=mono make menuconfig")
>

No, that's not what I meant. It works for me for all themes, see the
screenshot at https://postimg.cc/sBsM0twT . The terminal is tmux
inside hterm (which in turn is supposed to be compatible with xterm).
I guess I can test a couple of different terminals.

In which terminal is it not working for you?

>
> In the normal color mode, the foreground text is black.
> (Just like a picture in https://en.wikipedia.org/wiki/Menuconfig)
> A_DIM does nothing for black.
>
>
>
> --
> Best Regards
> Masahiro Yamada
Masahiro Yamada Jan. 16, 2024, 10:58 a.m. UTC | #5
On Mon, Jan 15, 2024 at 2:04 PM Tomasz Figa <tfiga@chromium.org> wrote:
>
> On Sat, Jan 13, 2024 at 8:23 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
> >
> > On Wed, Jan 10, 2024 at 10:05 PM Tomasz Figa <tfiga@chromium.org> wrote:
> > >
> > > On Fri, Dec 29, 2023 at 1:10 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
> > > >
> > > > On Thu, Dec 28, 2023 at 2:46 PM Tomasz Figa <tfiga@chromium.org> wrote:
> > > > >
> > > > > When hidden options are toggled on (using 'z'), the number of options
> > > > > on the screen can be overwhelming and may make it hard to distinguish
> > > > > between available and hidden ones. Make them easier to distinguish by
> > > > > displaying the hidden one as dim (using the A_DIM curses attribute).
> > > > >
> > > > > Signed-off-by: Tomasz Figa <tfiga@chromium.org>
> > > >
> > > >
> > > >
> > > > Do you think this is useful?
> > > >
> > > > This changes the color only when you select a hidden item.
> > > >
> > > >
> > > > For unselected items, you cannot distinguish hidden ones,
> > > > as A_DIM has no effect to black text.
> > > >
> > > >
> > >
> > > Hmm, are you sure about that? For me it seems to dim the text. it
> > > seems to be also used in the existing code for dlg.button_inactive.atr
> > > of the mono theme:
> > >
> > > https://elixir.bootlin.com/linux/latest/source/scripts/kconfig/lxdialog/util.c#L26
> >
> >
> >
> > Then, your code works only on the mono theme.
> > (when your terminal does not support color, or
> > "MENUCONFIG_COLOR=mono make menuconfig")
> >
>
> No, that's not what I meant. It works for me for all themes, see the
> screenshot at https://postimg.cc/sBsM0twT . The terminal is tmux
> inside hterm (which in turn is supposed to be compatible with xterm).
> I guess I can test a couple of different terminals.
>
> In which terminal is it not working for you?


I use gnome-terminal.
The disto is Ubuntu 23.10
Nicolas Schier Jan. 16, 2024, 12:01 p.m. UTC | #6
On Tue, Jan 16, 2024 at 07:58:05PM +0900, Masahiro Yamada wrote:
> On Mon, Jan 15, 2024 at 2:04 PM Tomasz Figa <tfiga@chromium.org> wrote:
> >
> > On Sat, Jan 13, 2024 at 8:23 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
> > >
> > > On Wed, Jan 10, 2024 at 10:05 PM Tomasz Figa <tfiga@chromium.org> wrote:
> > > >
> > > > On Fri, Dec 29, 2023 at 1:10 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
> > > > >
> > > > > On Thu, Dec 28, 2023 at 2:46 PM Tomasz Figa <tfiga@chromium.org> wrote:
> > > > > >
> > > > > > When hidden options are toggled on (using 'z'), the number of options
> > > > > > on the screen can be overwhelming and may make it hard to distinguish
> > > > > > between available and hidden ones. Make them easier to distinguish by
> > > > > > displaying the hidden one as dim (using the A_DIM curses attribute).
> > > > > >
> > > > > > Signed-off-by: Tomasz Figa <tfiga@chromium.org>
> > > > >
> > > > >
> > > > >
> > > > > Do you think this is useful?
> > > > >
> > > > > This changes the color only when you select a hidden item.
> > > > >
> > > > >
> > > > > For unselected items, you cannot distinguish hidden ones,
> > > > > as A_DIM has no effect to black text.
> > > > >
> > > > >
> > > >
> > > > Hmm, are you sure about that? For me it seems to dim the text. it
> > > > seems to be also used in the existing code for dlg.button_inactive.atr
> > > > of the mono theme:
> > > >
> > > > https://elixir.bootlin.com/linux/latest/source/scripts/kconfig/lxdialog/util.c#L26
> > >
> > >
> > >
> > > Then, your code works only on the mono theme.
> > > (when your terminal does not support color, or
> > > "MENUCONFIG_COLOR=mono make menuconfig")
> > >
> >
> > No, that's not what I meant. It works for me for all themes, see the
> > screenshot at https://postimg.cc/sBsM0twT . The terminal is tmux
> > inside hterm (which in turn is supposed to be compatible with xterm).
> > I guess I can test a couple of different terminals.
> >
> > In which terminal is it not working for you?
> 
> 
> I use gnome-terminal.
> The disto is Ubuntu 23.10

I see the same behaviour as Masahiro described with foot 1.13.1 on
Debian 12.

Kind regards,
Nicolas
Tomasz Figa Jan. 22, 2024, 4:13 a.m. UTC | #7
On Tue, Jan 16, 2024 at 9:01 PM Nicolas Schier <n.schier@avm.de> wrote:
>
> On Tue, Jan 16, 2024 at 07:58:05PM +0900, Masahiro Yamada wrote:
> > On Mon, Jan 15, 2024 at 2:04 PM Tomasz Figa <tfiga@chromium.org> wrote:
> > >
> > > On Sat, Jan 13, 2024 at 8:23 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
> > > >
> > > > On Wed, Jan 10, 2024 at 10:05 PM Tomasz Figa <tfiga@chromium.org> wrote:
> > > > >
> > > > > On Fri, Dec 29, 2023 at 1:10 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
> > > > > >
> > > > > > On Thu, Dec 28, 2023 at 2:46 PM Tomasz Figa <tfiga@chromium.org> wrote:
> > > > > > >
> > > > > > > When hidden options are toggled on (using 'z'), the number of options
> > > > > > > on the screen can be overwhelming and may make it hard to distinguish
> > > > > > > between available and hidden ones. Make them easier to distinguish by
> > > > > > > displaying the hidden one as dim (using the A_DIM curses attribute).
> > > > > > >
> > > > > > > Signed-off-by: Tomasz Figa <tfiga@chromium.org>
> > > > > >
> > > > > >
> > > > > >
> > > > > > Do you think this is useful?
> > > > > >
> > > > > > This changes the color only when you select a hidden item.
> > > > > >
> > > > > >
> > > > > > For unselected items, you cannot distinguish hidden ones,
> > > > > > as A_DIM has no effect to black text.
> > > > > >
> > > > > >
> > > > >
> > > > > Hmm, are you sure about that? For me it seems to dim the text. it
> > > > > seems to be also used in the existing code for dlg.button_inactive.atr
> > > > > of the mono theme:
> > > > >
> > > > > https://elixir.bootlin.com/linux/latest/source/scripts/kconfig/lxdialog/util.c#L26
> > > >
> > > >
> > > >
> > > > Then, your code works only on the mono theme.
> > > > (when your terminal does not support color, or
> > > > "MENUCONFIG_COLOR=mono make menuconfig")
> > > >
> > >
> > > No, that's not what I meant. It works for me for all themes, see the
> > > screenshot at https://postimg.cc/sBsM0twT . The terminal is tmux
> > > inside hterm (which in turn is supposed to be compatible with xterm).
> > > I guess I can test a couple of different terminals.
> > >
> > > In which terminal is it not working for you?
> >
> >
> > I use gnome-terminal.
> > The disto is Ubuntu 23.10
>
> I see the same behaviour as Masahiro described with foot 1.13.1 on
> Debian 12.

Thanks for testing! I'll use the two for my testing as well and try to
figure out something more portable.

Best regards,
Tomasz
diff mbox series

Patch

diff --git a/scripts/kconfig/lxdialog/dialog.h b/scripts/kconfig/lxdialog/dialog.h
index a501abf9fa31..d2ebdc6e2e28 100644
--- a/scripts/kconfig/lxdialog/dialog.h
+++ b/scripts/kconfig/lxdialog/dialog.h
@@ -128,6 +128,7 @@  void item_add_str(const char *fmt, ...);
 void item_set_tag(char tag);
 void item_set_data(void *p);
 void item_set_selected(int val);
+void item_set_hidden(int val);
 int item_activate_selected(void);
 void *item_data(void);
 char item_tag(void);
@@ -139,6 +140,7 @@  struct dialog_item {
 	char tag;
 	void *data;	/* pointer to menu item - used by menubox+checklist */
 	int selected;	/* Set to 1 by dialog_*() function if selected. */
+	int hidden;	/* Set to 1 if hidden. */
 };
 
 /* list of lialog_items */
@@ -157,6 +159,7 @@  int item_n(void);
 const char *item_str(void);
 int item_is_selected(void);
 int item_is_tag(char tag);
+int item_is_hidden(void);
 #define item_foreach() \
 	for (item_cur = item_head ? item_head: item_cur; \
 	     item_cur && (item_cur != &item_nil); item_cur = item_cur->next)
diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c
index 0e333284e947..2cf1f24f67b6 100644
--- a/scripts/kconfig/lxdialog/menubox.c
+++ b/scripts/kconfig/lxdialog/menubox.c
@@ -51,9 +51,9 @@  static int menu_width, item_x;
  * Print menu item
  */
 static void do_print_item(WINDOW * win, const char *item, int line_y,
-			  int selected, int hotkey)
+			  int selected, int hotkey, int hidden)
 {
-	int j;
+	int j, attrs;
 	char *menu_item = malloc(menu_width + 1);
 
 	strncpy(menu_item, item, menu_width - item_x);
@@ -64,7 +64,10 @@  static void do_print_item(WINDOW * win, const char *item, int line_y,
 	wattrset(win, dlg.menubox.atr);
 	wmove(win, line_y, 0);
 	wclrtoeol(win);
-	wattrset(win, selected ? dlg.item_selected.atr : dlg.item.atr);
+	attrs = selected ? dlg.item_selected.atr : dlg.item.atr;
+	if (hidden)
+		attrs |= A_DIM;
+	wattrset(win, attrs);
 	mvwaddstr(win, line_y, item_x, menu_item);
 	if (hotkey) {
 		wattrset(win, selected ? dlg.tag_key_selected.atr
@@ -81,7 +84,7 @@  static void do_print_item(WINDOW * win, const char *item, int line_y,
 #define print_item(index, choice, selected)				\
 do {									\
 	item_set(index);						\
-	do_print_item(menu, item_str(), choice, selected, !item_is_tag(':')); \
+	do_print_item(menu, item_str(), choice, selected, !item_is_tag(':'), item_is_hidden()); \
 } while (0)
 
 /*
diff --git a/scripts/kconfig/lxdialog/util.c b/scripts/kconfig/lxdialog/util.c
index 3f78fb265136..58d6ee96f7ec 100644
--- a/scripts/kconfig/lxdialog/util.c
+++ b/scripts/kconfig/lxdialog/util.c
@@ -635,6 +635,11 @@  void item_set_selected(int val)
 	item_cur->node.selected = val;
 }
 
+void item_set_hidden(int val)
+{
+	item_cur->node.hidden = val;
+}
+
 int item_activate_selected(void)
 {
 	item_foreach()
@@ -698,3 +703,8 @@  int item_is_tag(char tag)
 {
 	return (item_cur->node.tag == tag);
 }
+
+int item_is_hidden(void)
+{
+	return (item_cur->node.hidden != 0);
+}
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index eccc87a441e7..090121a1e5b6 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -539,6 +539,8 @@  static void build_conf(struct menu *menu)
 						  menu_is_empty(menu) ? "----" : "--->");
 				item_set_tag('m');
 				item_set_data(menu);
+				if (!visible)
+					item_set_hidden(TRUE);
 				if (single_menu_mode && menu->data)
 					goto conf_childs;
 				return;
@@ -548,6 +550,8 @@  static void build_conf(struct menu *menu)
 					item_make("   %*c*** %s ***", indent + 1, ' ', prompt);
 					item_set_tag(':');
 					item_set_data(menu);
+					if (!visible)
+						item_set_hidden(TRUE);
 				}
 				break;
 			default:
@@ -556,6 +560,8 @@  static void build_conf(struct menu *menu)
 					item_make("---%*c%s", indent + 1, ' ', prompt);
 					item_set_tag(':');
 					item_set_data(menu);
+					if (!visible)
+						item_set_hidden(TRUE);
 				}
 			}
 		} else
@@ -591,10 +597,14 @@  static void build_conf(struct menu *menu)
 			}
 			item_set_tag('t');
 			item_set_data(menu);
+			if (!visible)
+				item_set_hidden(TRUE);
 		} else {
 			item_make("   ");
 			item_set_tag(def_menu ? 't' : ':');
 			item_set_data(menu);
+			if (!visible)
+				item_set_hidden(TRUE);
 		}
 
 		item_add_str("%*c%s", indent + 1, ' ', menu_get_prompt(menu));
@@ -615,6 +625,8 @@  static void build_conf(struct menu *menu)
 			item_make("---%*c%s", indent + 1, ' ', menu_get_prompt(menu));
 			item_set_tag(':');
 			item_set_data(menu);
+			if (!visible)
+				item_set_hidden(TRUE);
 			goto conf_childs;
 		}
 		child_count++;
@@ -632,6 +644,8 @@  static void build_conf(struct menu *menu)
 					item_make("-%c-", val == no ? ' ' : '*');
 				item_set_tag('t');
 				item_set_data(menu);
+				if (!visible)
+					item_set_hidden(TRUE);
 				break;
 			case S_TRISTATE:
 				switch (val) {
@@ -648,6 +662,8 @@  static void build_conf(struct menu *menu)
 					item_make("-%c-", ch);
 				item_set_tag('t');
 				item_set_data(menu);
+				if (!visible)
+					item_set_hidden(TRUE);
 				break;
 			default:
 				tmp = 2 + strlen(sym_get_string_value(sym)); /* () = 2 */
@@ -660,6 +676,8 @@  static void build_conf(struct menu *menu)
 					     "" : " (NEW)");
 				item_set_tag('s');
 				item_set_data(menu);
+				if (!visible)
+					item_set_hidden(TRUE);
 				goto conf_childs;
 			}
 		}