Re: [RFC v7 1/1] mconf: global i-search in menu prompts

2018-06-19 Thread Dirk Gouders
Randy Dunlap  writes:

> On 06/19/2018 11:47 AM, Dirk Gouders wrote:
>> Randy Dunlap  writes:
>> 
>>> Hi Dirk,
>>>
>>> On 06/17/2018 05:15 AM, Dirk Gouders wrote:

 At any time, at most one i-search is active and the navigation path to
 the current menu is displayed in the subtitle, the second line in the
 menu window.
>>>
>>> Nice.
>>>
>>> And the highlight of the current menu item is also nice when TAB is used to
>>> switch to the buttons.  As well as toggling the help text based on context.
>>>
>>>
 Navigation example:

 To navigate to options concerning NFS file systems, simply type 'n',
 'f' and 's'.

 Hint: use the 'z' key with focus on buttons to search for invisible
   prompts.
>>>
>>> I think what this says is that the 'z' key is a toggle for the display of
>>> some (invisible) prompts.  Is that correct?
>>>
>>>
>>>
>>> I reliably (consistently) get a segfault.  I have hit it several times.
>>> Here is one way to get it:
>>>
>>> $ make menuconfig
>>> and then enter:
>>> /debug\
>> 
>> Hello Randy,
>> 
>> thank you for testing and your comments!
>> 
>> Concerning the segfault, I already have a version 8 prepared but wanted
>> to do more testing before disturbing people, again.
>> 
>> The initialization and operation of the serialized menu was ugly and
>> wrong.  I did not notice segfaults so far, but I can imagine the
>> segfaults you noticed are caused by this, because the code you tested
>> did not operate only on propper initialized array elements.
>> 
>> Before sending out version 8, I would like to include your other
>> suggestions as well, so could you please try the attached patch if that
>> also produces the segfaults?
>
> Yes, this one is working for me without faults.

Thank you very much.

I will prepare a v8 with your comments on the diff also respected.

Dirk


Re: [RFC v7 1/1] mconf: global i-search in menu prompts

2018-06-19 Thread Dirk Gouders
Randy Dunlap  writes:

> On 06/19/2018 11:47 AM, Dirk Gouders wrote:
>> Randy Dunlap  writes:
>> 
>>> Hi Dirk,
>>>
>>> On 06/17/2018 05:15 AM, Dirk Gouders wrote:

 At any time, at most one i-search is active and the navigation path to
 the current menu is displayed in the subtitle, the second line in the
 menu window.
>>>
>>> Nice.
>>>
>>> And the highlight of the current menu item is also nice when TAB is used to
>>> switch to the buttons.  As well as toggling the help text based on context.
>>>
>>>
 Navigation example:

 To navigate to options concerning NFS file systems, simply type 'n',
 'f' and 's'.

 Hint: use the 'z' key with focus on buttons to search for invisible
   prompts.
>>>
>>> I think what this says is that the 'z' key is a toggle for the display of
>>> some (invisible) prompts.  Is that correct?
>>>
>>>
>>>
>>> I reliably (consistently) get a segfault.  I have hit it several times.
>>> Here is one way to get it:
>>>
>>> $ make menuconfig
>>> and then enter:
>>> /debug\
>> 
>> Hello Randy,
>> 
>> thank you for testing and your comments!
>> 
>> Concerning the segfault, I already have a version 8 prepared but wanted
>> to do more testing before disturbing people, again.
>> 
>> The initialization and operation of the serialized menu was ugly and
>> wrong.  I did not notice segfaults so far, but I can imagine the
>> segfaults you noticed are caused by this, because the code you tested
>> did not operate only on propper initialized array elements.
>> 
>> Before sending out version 8, I would like to include your other
>> suggestions as well, so could you please try the attached patch if that
>> also produces the segfaults?
>
> Yes, this one is working for me without faults.

Thank you very much.

I will prepare a v8 with your comments on the diff also respected.

Dirk


Re: [RFC v7 1/1] mconf: global i-search in menu prompts

2018-06-19 Thread Randy Dunlap
On 06/19/2018 11:47 AM, Dirk Gouders wrote:
> Randy Dunlap  writes:
> 
>> Hi Dirk,
>>
>> On 06/17/2018 05:15 AM, Dirk Gouders wrote:
>>>
>>> At any time, at most one i-search is active and the navigation path to
>>> the current menu is displayed in the subtitle, the second line in the
>>> menu window.
>>
>> Nice.
>>
>> And the highlight of the current menu item is also nice when TAB is used to
>> switch to the buttons.  As well as toggling the help text based on context.
>>
>>
>>> Navigation example:
>>>
>>> To navigate to options concerning NFS file systems, simply type 'n',
>>> 'f' and 's'.
>>>
>>> Hint: use the 'z' key with focus on buttons to search for invisible
>>>   prompts.
>>
>> I think what this says is that the 'z' key is a toggle for the display of
>> some (invisible) prompts.  Is that correct?
>>
>>
>>
>> I reliably (consistently) get a segfault.  I have hit it several times.
>> Here is one way to get it:
>>
>> $ make menuconfig
>> and then enter:
>> /debug\
> 
> Hello Randy,
> 
> thank you for testing and your comments!
> 
> Concerning the segfault, I already have a version 8 prepared but wanted
> to do more testing before disturbing people, again.
> 
> The initialization and operation of the serialized menu was ugly and
> wrong.  I did not notice segfaults so far, but I can imagine the
> segfaults you noticed are caused by this, because the code you tested
> did not operate only on propper initialized array elements.
> 
> Before sending out version 8, I would like to include your other
> suggestions as well, so could you please try the attached patch if that
> also produces the segfaults?

Yes, this one is working for me without faults.

thanks,
-- 
~Randy


Re: [RFC v7 1/1] mconf: global i-search in menu prompts

2018-06-19 Thread Randy Dunlap
On 06/19/2018 11:47 AM, Dirk Gouders wrote:
> Randy Dunlap  writes:
> 
>> Hi Dirk,
>>
>> On 06/17/2018 05:15 AM, Dirk Gouders wrote:
>>>
>>> At any time, at most one i-search is active and the navigation path to
>>> the current menu is displayed in the subtitle, the second line in the
>>> menu window.
>>
>> Nice.
>>
>> And the highlight of the current menu item is also nice when TAB is used to
>> switch to the buttons.  As well as toggling the help text based on context.
>>
>>
>>> Navigation example:
>>>
>>> To navigate to options concerning NFS file systems, simply type 'n',
>>> 'f' and 's'.
>>>
>>> Hint: use the 'z' key with focus on buttons to search for invisible
>>>   prompts.
>>
>> I think what this says is that the 'z' key is a toggle for the display of
>> some (invisible) prompts.  Is that correct?
>>
>>
>>
>> I reliably (consistently) get a segfault.  I have hit it several times.
>> Here is one way to get it:
>>
>> $ make menuconfig
>> and then enter:
>> /debug\
> 
> Hello Randy,
> 
> thank you for testing and your comments!
> 
> Concerning the segfault, I already have a version 8 prepared but wanted
> to do more testing before disturbing people, again.
> 
> The initialization and operation of the serialized menu was ugly and
> wrong.  I did not notice segfaults so far, but I can imagine the
> segfaults you noticed are caused by this, because the code you tested
> did not operate only on propper initialized array elements.
> 
> Before sending out version 8, I would like to include your other
> suggestions as well, so could you please try the attached patch if that
> also produces the segfaults?

Yes, this one is working for me without faults.

thanks,
-- 
~Randy


Re: [RFC v7 1/1] mconf: global i-search in menu prompts

2018-06-19 Thread Dirk Gouders
Randy Dunlap  writes:

> Hi Dirk,
>
> On 06/17/2018 05:15 AM, Dirk Gouders wrote:
>> 
>> At any time, at most one i-search is active and the navigation path to
>> the current menu is displayed in the subtitle, the second line in the
>> menu window.
>
> Nice.
>
> And the highlight of the current menu item is also nice when TAB is used to
> switch to the buttons.  As well as toggling the help text based on context.
>
>
>> Navigation example:
>> 
>> To navigate to options concerning NFS file systems, simply type 'n',
>> 'f' and 's'.
>> 
>> Hint: use the 'z' key with focus on buttons to search for invisible
>>   prompts.
>
> I think what this says is that the 'z' key is a toggle for the display of
> some (invisible) prompts.  Is that correct?
>
>
>
> I reliably (consistently) get a segfault.  I have hit it several times.
> Here is one way to get it:
>
> $ make menuconfig
> and then enter:
> /debug\

Hello Randy,

thank you for testing and your comments!

Concerning the segfault, I already have a version 8 prepared but wanted
to do more testing before disturbing people, again.

The initialization and operation of the serialized menu was ugly and
wrong.  I did not notice segfaults so far, but I can imagine the
segfaults you noticed are caused by this, because the code you tested
did not operate only on propper initialized array elements.

Before sending out version 8, I would like to include your other
suggestions as well, so could you please try the attached patch if that
also produces the segfaults?

Thanks,

Dirk

>From 2da56e80fa17adbcb11c8fc86e253f55001f1494 Mon Sep 17 00:00:00 2001
From: Dirk Gouders 
Date: Fri, 15 Jun 2018 23:07:28 +0200
Subject: [PATCH 1/1] mconf: global i-search in menu prompts

Some menus in the kernel configuration are rather large and it can be
time-consuming for a user to navigate through several menu items to
reach the menu entry that he wants to modify -- for users with
less than 100% healthy eyes, this process can also be challenging.

An i-search functionality could safe the user from a lot of reading if
he knows a keyword that can be used for navigation and this patch
implements an i-search navigation concept for mconf based on an idea
by Sam Ravnborg:

* mconf now distinguishes if the focus is on the menu items or the
  buttons below it.

* At startup focus is on the menu items and printable characters
  (details see below) entered are used to form a string that is
  searched for in the menu prompts.

This patch implements a global cyclic i-search in the prompts of the
complete menu tree.  For ease of cyclic searches, the menu tree is
serialized into an array at startup.  For example, the following tree

a1 - b1 - c1 - d1 - e1
 | |
 b2d2 - d3
   |
   d4

is serialized to

a1 - b1 - b2 - c1 - d1 - d2 - d4 - d3 - e1

Operation
-
The TAB key is reserved to toggle the focus between menu and bottons.
Focus is on the buttons if one of the buttens (the active one) is
hightlighted, otherwise it is on the menu.

When the focus is on the buttons, mconf operates as before with the
exception of the TAB key.

When the focus is on the menu, mconf operates in i-search mode and the
following input has special meaning:

* <\> (backslash) can be used to search for other occurences of an
  already entered string.  On empty search strings, nothing happens.

* Any other printable character than backslash and '\n' is appended to
  the current search string and a match is searched for.  If a match
  is found, it is immediately navigated to.

* BACKSPACE is used to remove the last character of the search string.

* DEL clears the search string.

* ENTER can be used to enter a submenu.

* ESC ESC exits the current isearch and clears the search string.

* Horizontal arrow keys still cycle between the buttons but also
  switch focus to the buttons.

* Vertical arroy keys navigate the menu items.

At any time, at most one i-search is active and the navigation path to
the current menu is displayed in the subtitle, the second line in the
menu window.

Navigation example:

To navigate to options concerning NFS file systems, simply type 'n',
'f' and 's'.

Hint: use the 'z' key with focus on buttons to search for invisible
  prompts.

Particular changes to existing code
---
* The function print_autowrap() only printed non-whitespace characters
  and thus could not be used to overwrite existing text.  It was
  extended by a parameter "height" and in combination with the
  parameter "width" it now makes sure that the whole region (width x
  height) is overwritten.

* The function conf() now returns the key the user pressed so that
  calling functions can operate depending on that key.

Signed-off-by: Dirk Gouders 
---
 scripts/kconfig/lxdialog/checklist.c |   2 +-
 scripts/kconfig/lxdialog/dialog.h|   3 +-
 scripts/kconfig/lxdialog/inputbox.c  |   2 +-
 scripts/kconfig/lxdialog/menubox.c   | 181 

Re: [RFC v7 1/1] mconf: global i-search in menu prompts

2018-06-19 Thread Dirk Gouders
Randy Dunlap  writes:

> Hi Dirk,
>
> On 06/17/2018 05:15 AM, Dirk Gouders wrote:
>> 
>> At any time, at most one i-search is active and the navigation path to
>> the current menu is displayed in the subtitle, the second line in the
>> menu window.
>
> Nice.
>
> And the highlight of the current menu item is also nice when TAB is used to
> switch to the buttons.  As well as toggling the help text based on context.
>
>
>> Navigation example:
>> 
>> To navigate to options concerning NFS file systems, simply type 'n',
>> 'f' and 's'.
>> 
>> Hint: use the 'z' key with focus on buttons to search for invisible
>>   prompts.
>
> I think what this says is that the 'z' key is a toggle for the display of
> some (invisible) prompts.  Is that correct?
>
>
>
> I reliably (consistently) get a segfault.  I have hit it several times.
> Here is one way to get it:
>
> $ make menuconfig
> and then enter:
> /debug\

Hello Randy,

thank you for testing and your comments!

Concerning the segfault, I already have a version 8 prepared but wanted
to do more testing before disturbing people, again.

The initialization and operation of the serialized menu was ugly and
wrong.  I did not notice segfaults so far, but I can imagine the
segfaults you noticed are caused by this, because the code you tested
did not operate only on propper initialized array elements.

Before sending out version 8, I would like to include your other
suggestions as well, so could you please try the attached patch if that
also produces the segfaults?

Thanks,

Dirk

>From 2da56e80fa17adbcb11c8fc86e253f55001f1494 Mon Sep 17 00:00:00 2001
From: Dirk Gouders 
Date: Fri, 15 Jun 2018 23:07:28 +0200
Subject: [PATCH 1/1] mconf: global i-search in menu prompts

Some menus in the kernel configuration are rather large and it can be
time-consuming for a user to navigate through several menu items to
reach the menu entry that he wants to modify -- for users with
less than 100% healthy eyes, this process can also be challenging.

An i-search functionality could safe the user from a lot of reading if
he knows a keyword that can be used for navigation and this patch
implements an i-search navigation concept for mconf based on an idea
by Sam Ravnborg:

* mconf now distinguishes if the focus is on the menu items or the
  buttons below it.

* At startup focus is on the menu items and printable characters
  (details see below) entered are used to form a string that is
  searched for in the menu prompts.

This patch implements a global cyclic i-search in the prompts of the
complete menu tree.  For ease of cyclic searches, the menu tree is
serialized into an array at startup.  For example, the following tree

a1 - b1 - c1 - d1 - e1
 | |
 b2d2 - d3
   |
   d4

is serialized to

a1 - b1 - b2 - c1 - d1 - d2 - d4 - d3 - e1

Operation
-
The TAB key is reserved to toggle the focus between menu and bottons.
Focus is on the buttons if one of the buttens (the active one) is
hightlighted, otherwise it is on the menu.

When the focus is on the buttons, mconf operates as before with the
exception of the TAB key.

When the focus is on the menu, mconf operates in i-search mode and the
following input has special meaning:

* <\> (backslash) can be used to search for other occurences of an
  already entered string.  On empty search strings, nothing happens.

* Any other printable character than backslash and '\n' is appended to
  the current search string and a match is searched for.  If a match
  is found, it is immediately navigated to.

* BACKSPACE is used to remove the last character of the search string.

* DEL clears the search string.

* ENTER can be used to enter a submenu.

* ESC ESC exits the current isearch and clears the search string.

* Horizontal arrow keys still cycle between the buttons but also
  switch focus to the buttons.

* Vertical arroy keys navigate the menu items.

At any time, at most one i-search is active and the navigation path to
the current menu is displayed in the subtitle, the second line in the
menu window.

Navigation example:

To navigate to options concerning NFS file systems, simply type 'n',
'f' and 's'.

Hint: use the 'z' key with focus on buttons to search for invisible
  prompts.

Particular changes to existing code
---
* The function print_autowrap() only printed non-whitespace characters
  and thus could not be used to overwrite existing text.  It was
  extended by a parameter "height" and in combination with the
  parameter "width" it now makes sure that the whole region (width x
  height) is overwritten.

* The function conf() now returns the key the user pressed so that
  calling functions can operate depending on that key.

Signed-off-by: Dirk Gouders 
---
 scripts/kconfig/lxdialog/checklist.c |   2 +-
 scripts/kconfig/lxdialog/dialog.h|   3 +-
 scripts/kconfig/lxdialog/inputbox.c  |   2 +-
 scripts/kconfig/lxdialog/menubox.c   | 181 

Re: [RFC v7 1/1] mconf: global i-search in menu prompts

2018-06-19 Thread Randy Dunlap
On 06/17/2018 05:15 AM, Dirk Gouders wrote:

> Signed-off-by: Dirk Gouders 
> ---
>  scripts/kconfig/lxdialog/checklist.c |   2 +-
>  scripts/kconfig/lxdialog/dialog.h|   3 +-
>  scripts/kconfig/lxdialog/inputbox.c  |   2 +-
>  scripts/kconfig/lxdialog/menubox.c   | 181 +---
>  scripts/kconfig/lxdialog/util.c  |  45 +-
>  scripts/kconfig/lxdialog/yesno.c |   2 +-
>  scripts/kconfig/mconf.c  | 202 +--
>  7 files changed, 398 insertions(+), 39 deletions(-)

Hi Dirk,

A few typos below...


> diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
> index 5294ed159b98..e2e6fc973f6f 100644
> --- a/scripts/kconfig/mconf.c
> +++ b/scripts/kconfig/mconf.c
> @@ -21,6 +21,12 @@
>  #include "lkc.h"
>  #include "lxdialog/dialog.h"
>  
> +extern int focus_on_buttons;
> +extern char isearch_str[];
> +static struct menu **flat_menu; /* serialized menu tree */
> +static int flat_menu_max = 10;
> +static int in_isearch; /* Ensure at most one instance of 
> i-search is active */
> +
>  static const char mconf_readme[] =
>  "Overview\n"
>  "\n"
> @@ -36,20 +42,74 @@ static const char mconf_readme[] =
>  "while *, M or whitespace inside braces means to build in, build as\n"
>  "a module or to exclude the feature respectively.\n"
>  "\n"
> -"To change any of these features, highlight it with the cursor\n"
> -"keys and press  to build it in,  to make it a module or\n"
> +"Operation modes\n"
> +"---\n"
> +"Menuconfig operates in two modes, depending on the focus that can be\n"
> +"either on the menu or the buttons below it. The focus is on the\n"
> +"buttons if one button (the selected one) is highlighted, otherwise it\n"
> +"is on the menu.\n"
> +"\n"
> +"To change any of the above features, it has to be navigated to (see\n"
> +"below) so that it is highlited, focus then has to be on the buttons\n"

 highlighted,

> +"before you press  to build it in,  to make it a module or\n"
>  " to remove it.  You may also press the  to cycle\n"
>  "through the available options (i.e. Y->N->M->Y).\n"
>  "\n"
> +"Navigation\n"
> +"--\n"
> +"The following keys work independent of the current focus:\n"

independently

> +"\n"
> +"o vertical arrow keys are used to navigate to menu items\n"
> +"\n"
> +"o horizontal arrow keys put the focus on the buttons and cycle\n"
> +"  between the buttons.\n"
> +"\n"
> +"o  and  scroll invisible items into view.\n"
> +"\n"
> +"o  visits a submenu\n"
> +"  Submenus are designated by \"--->\", empty ones by \"\".\n"
> +"\n"
> +"o  leaves a submenu or (in the main menu) exits menuconfig\n"
> +"  and clears the current i-search string."
> +"\n"
> +"o  is reserved to toggle the focus between menu and buttons\n"
> +"\n"
> +"When menuconfig starts, the focus is on the menu and i-search mode\n"
> +"is active.  I-search performs continuous cyclic searches for an entered\n"
> +"string in the prompt texts of the whole menu tree.\n"
> +"\n"
> +"Subsequent characters can be entered to build a search-string the\n"
> +"menu items are searched for and each time a character is added the\n"
> +"current string is searched for starting from the current position in\n"
> +"the menu tree.  If a match is found it is immediately navigated to.\n"
> +"\n"
> +"Keys with a special meaning are:\n"
> +"\n"
> +"o  removes the last character from the current search string\n"
> +"\n"
> +"o  clears the search string\n"
> +"\n"
> +"o <\\> (backslash) can be used to find further matches of a string\n"
> +"\n"
> +"When the focus is on the buttons the following keys can be used:\n"
> +"\n"
> +"o  can be used for exit identical to \n"
> +"\n"
> +"o , ,  or  change the selected item\n"
> +"\n"
> +"o <+> and <-> keys navigate menu items identical to vertical arrow\n"
> +"  keys\n"
> +"\n"
> +"o  or  display help messages\n"
> +"\n"
> +"o  toggles the display of hidden options\n"

Ah, there it is!  Thanks.

> +"\n"
>  "Some additional keyboard hints:\n"
>  "\n"
>  "Menus\n"
>  "--\n"
> -"o  Use the Up/Down arrow keys (cursor keys) to highlight the item you\n"
> -"   wish to change or the submenu you wish to select and press .\n"
> -"   Submenus are designated by \"--->\", empty ones by \"\".\n"
> -"\n"
> -"   Shortcut: Press the option's highlighted letter (hotkey).\n"
> +"o  Hotkeys (available with focus on buttons): Press the target option's\n"
> +" highlighted letter (hotkey).\n"
>  " Pressing a hotkey more than once will sequence\n"
>  " through all visible items which use that hotkey.\n"
>  "\n"


thanks,
-- 
~Randy


Re: [RFC v7 1/1] mconf: global i-search in menu prompts

2018-06-19 Thread Randy Dunlap
On 06/17/2018 05:15 AM, Dirk Gouders wrote:

> Signed-off-by: Dirk Gouders 
> ---
>  scripts/kconfig/lxdialog/checklist.c |   2 +-
>  scripts/kconfig/lxdialog/dialog.h|   3 +-
>  scripts/kconfig/lxdialog/inputbox.c  |   2 +-
>  scripts/kconfig/lxdialog/menubox.c   | 181 +---
>  scripts/kconfig/lxdialog/util.c  |  45 +-
>  scripts/kconfig/lxdialog/yesno.c |   2 +-
>  scripts/kconfig/mconf.c  | 202 +--
>  7 files changed, 398 insertions(+), 39 deletions(-)

Hi Dirk,

A few typos below...


> diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
> index 5294ed159b98..e2e6fc973f6f 100644
> --- a/scripts/kconfig/mconf.c
> +++ b/scripts/kconfig/mconf.c
> @@ -21,6 +21,12 @@
>  #include "lkc.h"
>  #include "lxdialog/dialog.h"
>  
> +extern int focus_on_buttons;
> +extern char isearch_str[];
> +static struct menu **flat_menu; /* serialized menu tree */
> +static int flat_menu_max = 10;
> +static int in_isearch; /* Ensure at most one instance of 
> i-search is active */
> +
>  static const char mconf_readme[] =
>  "Overview\n"
>  "\n"
> @@ -36,20 +42,74 @@ static const char mconf_readme[] =
>  "while *, M or whitespace inside braces means to build in, build as\n"
>  "a module or to exclude the feature respectively.\n"
>  "\n"
> -"To change any of these features, highlight it with the cursor\n"
> -"keys and press  to build it in,  to make it a module or\n"
> +"Operation modes\n"
> +"---\n"
> +"Menuconfig operates in two modes, depending on the focus that can be\n"
> +"either on the menu or the buttons below it. The focus is on the\n"
> +"buttons if one button (the selected one) is highlighted, otherwise it\n"
> +"is on the menu.\n"
> +"\n"
> +"To change any of the above features, it has to be navigated to (see\n"
> +"below) so that it is highlited, focus then has to be on the buttons\n"

 highlighted,

> +"before you press  to build it in,  to make it a module or\n"
>  " to remove it.  You may also press the  to cycle\n"
>  "through the available options (i.e. Y->N->M->Y).\n"
>  "\n"
> +"Navigation\n"
> +"--\n"
> +"The following keys work independent of the current focus:\n"

independently

> +"\n"
> +"o vertical arrow keys are used to navigate to menu items\n"
> +"\n"
> +"o horizontal arrow keys put the focus on the buttons and cycle\n"
> +"  between the buttons.\n"
> +"\n"
> +"o  and  scroll invisible items into view.\n"
> +"\n"
> +"o  visits a submenu\n"
> +"  Submenus are designated by \"--->\", empty ones by \"\".\n"
> +"\n"
> +"o  leaves a submenu or (in the main menu) exits menuconfig\n"
> +"  and clears the current i-search string."
> +"\n"
> +"o  is reserved to toggle the focus between menu and buttons\n"
> +"\n"
> +"When menuconfig starts, the focus is on the menu and i-search mode\n"
> +"is active.  I-search performs continuous cyclic searches for an entered\n"
> +"string in the prompt texts of the whole menu tree.\n"
> +"\n"
> +"Subsequent characters can be entered to build a search-string the\n"
> +"menu items are searched for and each time a character is added the\n"
> +"current string is searched for starting from the current position in\n"
> +"the menu tree.  If a match is found it is immediately navigated to.\n"
> +"\n"
> +"Keys with a special meaning are:\n"
> +"\n"
> +"o  removes the last character from the current search string\n"
> +"\n"
> +"o  clears the search string\n"
> +"\n"
> +"o <\\> (backslash) can be used to find further matches of a string\n"
> +"\n"
> +"When the focus is on the buttons the following keys can be used:\n"
> +"\n"
> +"o  can be used for exit identical to \n"
> +"\n"
> +"o , ,  or  change the selected item\n"
> +"\n"
> +"o <+> and <-> keys navigate menu items identical to vertical arrow\n"
> +"  keys\n"
> +"\n"
> +"o  or  display help messages\n"
> +"\n"
> +"o  toggles the display of hidden options\n"

Ah, there it is!  Thanks.

> +"\n"
>  "Some additional keyboard hints:\n"
>  "\n"
>  "Menus\n"
>  "--\n"
> -"o  Use the Up/Down arrow keys (cursor keys) to highlight the item you\n"
> -"   wish to change or the submenu you wish to select and press .\n"
> -"   Submenus are designated by \"--->\", empty ones by \"\".\n"
> -"\n"
> -"   Shortcut: Press the option's highlighted letter (hotkey).\n"
> +"o  Hotkeys (available with focus on buttons): Press the target option's\n"
> +" highlighted letter (hotkey).\n"
>  " Pressing a hotkey more than once will sequence\n"
>  " through all visible items which use that hotkey.\n"
>  "\n"


thanks,
-- 
~Randy


Re: [RFC v7 1/1] mconf: global i-search in menu prompts

2018-06-19 Thread Randy Dunlap
Hi Dirk,

On 06/17/2018 05:15 AM, Dirk Gouders wrote:
> 
> At any time, at most one i-search is active and the navigation path to
> the current menu is displayed in the subtitle, the second line in the
> menu window.

Nice.

And the highlight of the current menu item is also nice when TAB is used to
switch to the buttons.  As well as toggling the help text based on context.


> Navigation example:
> 
> To navigate to options concerning NFS file systems, simply type 'n',
> 'f' and 's'.
> 
> Hint: use the 'z' key with focus on buttons to search for invisible
>   prompts.

I think what this says is that the 'z' key is a toggle for the display of
some (invisible) prompts.  Is that correct?



I reliably (consistently) get a segfault.  I have hit it several times.
Here is one way to get it:

$ make menuconfig
and then enter:
/debug\



thanks,
-- 
~Randy


Re: [RFC v7 1/1] mconf: global i-search in menu prompts

2018-06-19 Thread Randy Dunlap
Hi Dirk,

On 06/17/2018 05:15 AM, Dirk Gouders wrote:
> 
> At any time, at most one i-search is active and the navigation path to
> the current menu is displayed in the subtitle, the second line in the
> menu window.

Nice.

And the highlight of the current menu item is also nice when TAB is used to
switch to the buttons.  As well as toggling the help text based on context.


> Navigation example:
> 
> To navigate to options concerning NFS file systems, simply type 'n',
> 'f' and 's'.
> 
> Hint: use the 'z' key with focus on buttons to search for invisible
>   prompts.

I think what this says is that the 'z' key is a toggle for the display of
some (invisible) prompts.  Is that correct?



I reliably (consistently) get a segfault.  I have hit it several times.
Here is one way to get it:

$ make menuconfig
and then enter:
/debug\



thanks,
-- 
~Randy


[RFC v7 1/1] mconf: global i-search in menu prompts

2018-06-17 Thread Dirk Gouders
Some menus in the kernel configuration are rather large and it can be
time-consuming for a user to navigate through several menu items to
reach the menu entry that he wants to modify -- for users with
less than 100% healthy eyes, this process can also be challenging.

An i-search functionality could safe the user from a lot of reading if
he knows a keyword that can be used for navigation and this patch
implements an i-search navigation concept for mconf based on an idea
by Sam Ravnborg:

* mconf now distinguishes if the focus is on the menu items or the
  buttons below it.

* At startup focus is on the menu items and printable characters
  (details see below) entered are used to form a string that is
  searched for in the menu prompts.

This patch implements a global cyclic i-search in the prompts of the
complete menu tree.  For ease of cyclic searches, the menu tree is
serialized into an array at startup.  For example, the following tree

a1 - b1 - c1 - d1 - e1
 | |
 b2d2 - d3
   |
   d4

is serialized to

a1 - b1 - b2 - c1 - d1 - d2 - d4 - d3 - e1

Operation
-
The TAB key is reserved to toggle the focus between menu and bottons.
Focus is on the buttons if one of the buttens (the active one) is
hightlighted, otherwise it is on the menu.

When the focus is on the buttons, mconf operates as before with the
exception of the TAB key.

When the focus is on the menu, mconf operates in i-search mode and the
following input has special meaning:

* <\> (backslash) can be used to search for other occurences of an
  already entered string.  On empty search strings, nothing happens.

* Any other printable character than backslash and '\n' is appended to
  the current search string and a match is searched for.  If a match
  is found, it is immediately navigated to.

* BACKSPACE is used to remove the last character of the search string.

* DEL clears the search string.

* ENTER can be used to enter a submenu.

* ESC ESC exits the current isearch and clears the search string.

* Horizontal arrow keys still cycle between the buttons but also
  switch focus to the buttons.

* Vertical arroy keys navigate the menu items.

At any time, at most one i-search is active and the navigation path to
the current menu is displayed in the subtitle, the second line in the
menu window.

Navigation example:

To navigate to options concerning NFS file systems, simply type 'n',
'f' and 's'.

Hint: use the 'z' key with focus on buttons to search for invisible
  prompts.

Particular changes to existing code
---
* The function print_autowrap() only printed non-whitespace characters
  and thus could not be used to overwrite existing text.  It was
  extended by a parameter "height" and in combination with the
  parameter "width" it now makes sure that the whole region (width x
  height) is overwritten.

* The function conf() now returns the key the user pressed so that
  calling functions can operate depending on that key.

Signed-off-by: Dirk Gouders 
---
 scripts/kconfig/lxdialog/checklist.c |   2 +-
 scripts/kconfig/lxdialog/dialog.h|   3 +-
 scripts/kconfig/lxdialog/inputbox.c  |   2 +-
 scripts/kconfig/lxdialog/menubox.c   | 181 +---
 scripts/kconfig/lxdialog/util.c  |  45 +-
 scripts/kconfig/lxdialog/yesno.c |   2 +-
 scripts/kconfig/mconf.c  | 202 +--
 7 files changed, 398 insertions(+), 39 deletions(-)

diff --git a/scripts/kconfig/lxdialog/checklist.c 
b/scripts/kconfig/lxdialog/checklist.c
index 2e96323ad11b..2a8bd877af72 100644
--- a/scripts/kconfig/lxdialog/checklist.c
+++ b/scripts/kconfig/lxdialog/checklist.c
@@ -160,7 +160,7 @@ int dialog_checklist(const char *title, const char *prompt, 
int height,
print_title(dialog, title, width);
 
wattrset(dialog, dlg.dialog.atr);
-   print_autowrap(dialog, prompt, width - 2, 1, 3);
+   print_autowrap(dialog, prompt, width - 2, 3, 1, 3);
 
list_width = width - 6;
box_y = height - list_height - 5;
diff --git a/scripts/kconfig/lxdialog/dialog.h 
b/scripts/kconfig/lxdialog/dialog.h
index 0b00be5abaa6..9396ed2122f9 100644
--- a/scripts/kconfig/lxdialog/dialog.h
+++ b/scripts/kconfig/lxdialog/dialog.h
@@ -214,7 +214,8 @@ void set_dialog_subtitles(struct subtitle_list *subtitles);
 void end_dialog(int x, int y);
 void attr_clear(WINDOW * win, int height, int width, chtype attr);
 void dialog_clear(void);
-void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x);
+void print_autowrap(WINDOW * win, const char *prompt,
+   int width, int height, int y, int x);
 void print_button(WINDOW * win, const char *label, int y, int x, int selected);
 void print_title(WINDOW *dialog, const char *title, int width);
 void draw_box(WINDOW * win, int y, int x, int height, int width, chtype box,
diff --git a/scripts/kconfig/lxdialog/inputbox.c 

[RFC v7 1/1] mconf: global i-search in menu prompts

2018-06-17 Thread Dirk Gouders
Some menus in the kernel configuration are rather large and it can be
time-consuming for a user to navigate through several menu items to
reach the menu entry that he wants to modify -- for users with
less than 100% healthy eyes, this process can also be challenging.

An i-search functionality could safe the user from a lot of reading if
he knows a keyword that can be used for navigation and this patch
implements an i-search navigation concept for mconf based on an idea
by Sam Ravnborg:

* mconf now distinguishes if the focus is on the menu items or the
  buttons below it.

* At startup focus is on the menu items and printable characters
  (details see below) entered are used to form a string that is
  searched for in the menu prompts.

This patch implements a global cyclic i-search in the prompts of the
complete menu tree.  For ease of cyclic searches, the menu tree is
serialized into an array at startup.  For example, the following tree

a1 - b1 - c1 - d1 - e1
 | |
 b2d2 - d3
   |
   d4

is serialized to

a1 - b1 - b2 - c1 - d1 - d2 - d4 - d3 - e1

Operation
-
The TAB key is reserved to toggle the focus between menu and bottons.
Focus is on the buttons if one of the buttens (the active one) is
hightlighted, otherwise it is on the menu.

When the focus is on the buttons, mconf operates as before with the
exception of the TAB key.

When the focus is on the menu, mconf operates in i-search mode and the
following input has special meaning:

* <\> (backslash) can be used to search for other occurences of an
  already entered string.  On empty search strings, nothing happens.

* Any other printable character than backslash and '\n' is appended to
  the current search string and a match is searched for.  If a match
  is found, it is immediately navigated to.

* BACKSPACE is used to remove the last character of the search string.

* DEL clears the search string.

* ENTER can be used to enter a submenu.

* ESC ESC exits the current isearch and clears the search string.

* Horizontal arrow keys still cycle between the buttons but also
  switch focus to the buttons.

* Vertical arroy keys navigate the menu items.

At any time, at most one i-search is active and the navigation path to
the current menu is displayed in the subtitle, the second line in the
menu window.

Navigation example:

To navigate to options concerning NFS file systems, simply type 'n',
'f' and 's'.

Hint: use the 'z' key with focus on buttons to search for invisible
  prompts.

Particular changes to existing code
---
* The function print_autowrap() only printed non-whitespace characters
  and thus could not be used to overwrite existing text.  It was
  extended by a parameter "height" and in combination with the
  parameter "width" it now makes sure that the whole region (width x
  height) is overwritten.

* The function conf() now returns the key the user pressed so that
  calling functions can operate depending on that key.

Signed-off-by: Dirk Gouders 
---
 scripts/kconfig/lxdialog/checklist.c |   2 +-
 scripts/kconfig/lxdialog/dialog.h|   3 +-
 scripts/kconfig/lxdialog/inputbox.c  |   2 +-
 scripts/kconfig/lxdialog/menubox.c   | 181 +---
 scripts/kconfig/lxdialog/util.c  |  45 +-
 scripts/kconfig/lxdialog/yesno.c |   2 +-
 scripts/kconfig/mconf.c  | 202 +--
 7 files changed, 398 insertions(+), 39 deletions(-)

diff --git a/scripts/kconfig/lxdialog/checklist.c 
b/scripts/kconfig/lxdialog/checklist.c
index 2e96323ad11b..2a8bd877af72 100644
--- a/scripts/kconfig/lxdialog/checklist.c
+++ b/scripts/kconfig/lxdialog/checklist.c
@@ -160,7 +160,7 @@ int dialog_checklist(const char *title, const char *prompt, 
int height,
print_title(dialog, title, width);
 
wattrset(dialog, dlg.dialog.atr);
-   print_autowrap(dialog, prompt, width - 2, 1, 3);
+   print_autowrap(dialog, prompt, width - 2, 3, 1, 3);
 
list_width = width - 6;
box_y = height - list_height - 5;
diff --git a/scripts/kconfig/lxdialog/dialog.h 
b/scripts/kconfig/lxdialog/dialog.h
index 0b00be5abaa6..9396ed2122f9 100644
--- a/scripts/kconfig/lxdialog/dialog.h
+++ b/scripts/kconfig/lxdialog/dialog.h
@@ -214,7 +214,8 @@ void set_dialog_subtitles(struct subtitle_list *subtitles);
 void end_dialog(int x, int y);
 void attr_clear(WINDOW * win, int height, int width, chtype attr);
 void dialog_clear(void);
-void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x);
+void print_autowrap(WINDOW * win, const char *prompt,
+   int width, int height, int y, int x);
 void print_button(WINDOW * win, const char *label, int y, int x, int selected);
 void print_title(WINDOW *dialog, const char *title, int width);
 void draw_box(WINDOW * win, int y, int x, int height, int width, chtype box,
diff --git a/scripts/kconfig/lxdialog/inputbox.c