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(-)
--
1.8.3.2.736.g869de25
These letters that should not be used in menu selection.
Cc: Michal Marek <[email protected]>
Signed-off-by: Ramkumar Ramachandra <[email protected]>
---
scripts/kconfig/lxdialog/menubox.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c
index 38cd69c..5923f2c 100644
--- a/scripts/kconfig/lxdialog/menubox.c
+++ b/scripts/kconfig/lxdialog/menubox.c
@@ -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;
}
--
1.8.3.2.736.g869de25
Like in Vim.
Cc: Michal Marek <[email protected]>
Signed-off-by: Ramkumar Ramachandra <[email protected]>
---
scripts/kconfig/lxdialog/menubox.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c
index 698d7c3..151394a 100644
--- a/scripts/kconfig/lxdialog/menubox.c
+++ b/scripts/kconfig/lxdialog/menubox.c
@@ -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) &&
--
1.8.3.2.736.g869de25
first_alpha() checks only against lowercase characters anyway.
Cc: Michal Marek <[email protected]>
Signed-off-by: Ramkumar Ramachandra <[email protected]>
---
scripts/kconfig/lxdialog/menubox.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c
index 5923f2c..698d7c3 100644
--- a/scripts/kconfig/lxdialog/menubox.c
+++ b/scripts/kconfig/lxdialog/menubox.c
@@ -57,7 +57,7 @@
*/
#include "dialog.h"
-#define RESERVED_LETTERS "YyNnMmHh"
+#define RESERVED_LETTERS "ynmh"
static int menu_width, item_x;
--
1.8.3.2.736.g869de25
On 07/10/2013 10:15:15 AM, Ramkumar Ramachandra wrote:
> 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-