diff mbox

[v2] mconf: handle keys in empty dialogs

Message ID 1368992924-4700-1-git-send-email-dirk@gouders.net (mailing list archive)
State New, archived
Headers show

Commit Message

Dirk Gouders May 19, 2013, 7:48 p.m. UTC
When entering an empty dialog, using the movement keys resulted in
unexpected characters beeing displayed, other keys like "z" and "h"
did not work as expected.

This patch handles the movement keys as well as other keys, especially
"z", "h" and "/".

Signed-off-by: Dirk Gouders <dirk@gouders.net>
---
 scripts/kconfig/lxdialog/menubox.c |  8 ++++----
 scripts/kconfig/mconf.c            | 11 ++++++-----
 2 files changed, 10 insertions(+), 9 deletions(-)

Comments

Yann E. MORIN May 20, 2013, 3:51 p.m. UTC | #1
Dirk, All,

On 2013-05-19 21:48 +0200, Dirk Gouders spake thusly:
> When entering an empty dialog, using the movement keys resulted in
> unexpected characters beeing displayed, other keys like "z" and "h"
> did not work as expected.
> 
> This patch handles the movement keys as well as other keys, especially
> "z", "h" and "/".
> 
> Signed-off-by: Dirk Gouders <dirk@gouders.net>

I've applied this to my tree in the yem-kconfig-rc-fixes branch, for
which I just sent a pull-request to Michal. Thank you!

Regards,
Yann E. MORIN.
diff mbox

Patch

diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c
index 48d382e..eda0350 100644
--- a/scripts/kconfig/lxdialog/menubox.c
+++ b/scripts/kconfig/lxdialog/menubox.c
@@ -303,10 +303,10 @@  do_resize:
 				}
 		}
 
-		if (i < max_choice ||
-		    key == KEY_UP || key == KEY_DOWN ||
-		    key == '-' || key == '+' ||
-		    key == KEY_PPAGE || key == KEY_NPAGE) {
+		if ((i < max_choice ||
+		     key == KEY_UP || key == KEY_DOWN ||
+		     key == '-' || key == '+' ||
+		     key == KEY_PPAGE || key == KEY_NPAGE) && item_count() != 0) {
 			/* Remove highligt of current item */
 			print_item(scroll + choice, choice, FALSE);
 
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 387dc8d..a69cbd7 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -670,11 +670,12 @@  static void conf(struct menu *menu, struct menu *active_menu)
 				  active_menu, &s_scroll);
 		if (res == 1 || res == KEY_ESC || res == -ERRDISPLAYTOOSMALL)
 			break;
-		if (!item_activate_selected())
-			continue;
-		if (!item_tag())
-			continue;
-
+		if (item_count() != 0) {
+			if (!item_activate_selected())
+				continue;
+			if (!item_tag())
+				continue;
+		}
 		submenu = item_data();
 		active_menu = item_data();
 		if (submenu)