Modernize menuconfig a bit
v2 cover Modernize menuconfig a bit
Hi,
After Michal's (somewhat positive) response to the first iteration, here's the second iteration fixing the reserved-letters problem.
I also find hitting <ESC><ESC> to return to the previous page quite annoying, and I hope to tackle this in the future depending on how the community responds to [3/3].
Independent of part 3, I think parts 1 and 2 are obviously correct, and should be merged.
Thanks.
Ramkumar Ramachandra (3):
menuconfig: factor out reserved letters
menuconfig: remove redundant info from RESERVED_LETTERS
menuconfig: allow j/k to move down/up the menu
scripts/kconfig/lxdialog/menubox.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
Signature · 1 line
1.8.3.2.736.g869de25
PATCH v2 1/3 menuconfig: factor out reserved letters
These letters that should not be used in menu selection.
--- scripts/kconfig/lxdialog/menubox.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
scripts/kconfig/lxdialog/menubox.c +4 -3
@@ -57,6 +57,7 @@*/ #include "dialog.h" +#define RESERVED_LETTERS "YyNnMmHh"static int menu_width, item_x;
@@ -71,7 +72,7 @@ static void do_print_item(WINDOW * win, const char *item, int line_y,strncpy (menu_item, item, menu_width - item_x); menu_item[menu_width - item_x] ='\0' ; - j =first_alpha (menu_item,"YyNnMmHh" ); + j =first_alpha (menu_item,RESERVED_LETTERS );/* Clear 'residue' of last item */ wattrset (win, dlg.menubox.atr);
@@ -290,14 +291,14 @@ do_resize:else {for (i = choice +1 ; i < max_choice; i++) {item_set (scroll + i); - j =first_alpha (item_str (),"YyNnMmHh" ); + j =first_alpha (item_str (),RESERVED_LETTERS );if (key ==tolower (item_str ()[j]))break ; }if (i == max_choice)for (i =0 ; i < max_choice; i++) {item_set (scroll + i); - j =first_alpha (item_str (),"YyNnMmHh" ); + j =first_alpha (item_str (),RESERVED_LETTERS );if (key ==tolower (item_str ()[j]))break ; }
Signature · 1 line
1.8.3.2.736.g869de25
PATCH v2 2/3 menuconfig: remove redundant info from RESERVED_LETTERS
In reply to Ramkumar Ramachandrafirst_alpha() checks only against lowercase characters anyway.
--- scripts/kconfig/lxdialog/menubox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kconfig/lxdialog/menubox.c +1 -1
@@ -57,7 +57,7 @@*/ #include "dialog.h" -#define RESERVED_LETTERS "YyNnMmHh" +#define RESERVED_LETTERS "ynmh"static int menu_width, item_x;
Signature · 1 line
1.8.3.2.736.g869de25
PATCH v2 3/3 menuconfig: allow j/k to move down/up the menu
In reply to Ramkumar RamachandraLike in Vim.
--- scripts/kconfig/lxdialog/menubox.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
scripts/kconfig/lxdialog/menubox.c +4 -3
@@ -57,7 +57,7 @@*/ #include "dialog.h" -#define RESERVED_LETTERS "ynmh" +#define RESERVED_LETTERS "ynmhjk"static int menu_width, item_x;
@@ -308,11 +308,12 @@ do_resize: (i < max_choice || key == KEY_UP || key == KEY_DOWN || key == '-' || key == '+' || + key == 'j' || key == 'k' || key == KEY_PPAGE || key == KEY_NPAGE)) {/* Remove highligt of current item */ print_item (scroll + choice, choice, FALSE); -if (key ==KEY_UP || key =='-' ) { +if (key ==KEY_UP || key =='-' || key =='k' ) {if (choice <2 && scroll) {/* Scroll menu down */ do_scroll (menu, &scroll,-1 );
@@ -321,7 +322,7 @@ do_resize: }else choice =MAX (choice -1 ,0 ); - }else if (key ==KEY_DOWN || key =='+' ) { + }else if (key ==KEY_DOWN || key =='+' || key =='j' ) {print_item (scroll+choice, choice, FALSE); if ((choice > max_choice - 3) &&
Signature · 1 line
1.8.3.2.736.g869de25
Quoted 4 lines · Ramkumar Ramachandra
Hi,
After Michal's (somewhat positive) response to the first iteration, here's the second iteration fixing the reserved-letters problem.
Someone saying they keep accidentally killing processes in "top" is a positive response?
Rob