All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mconf: handle keys in empty dialogs
@ 2013-05-17  8:48 Dirk Gouders
  2013-05-19 15:12 ` Yann E. MORIN
  0 siblings, 1 reply; 4+ messages in thread
From: Dirk Gouders @ 2013-05-17  8:48 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: linux-kbuild

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(-)

diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c
index 48d382e..f5aff9c 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()) {
 			/* 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..ccb71ae 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()) {
+			if (!item_activate_selected())
+				continue;
+			if (!item_tag())
+				continue;
+		}
 		submenu = item_data();
 		active_menu = item_data();
 		if (submenu)
-- 
1.8.2.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mconf: handle keys in empty dialogs
  2013-05-17  8:48 [PATCH] mconf: handle keys in empty dialogs Dirk Gouders
@ 2013-05-19 15:12 ` Yann E. MORIN
  2013-05-19 19:48   ` [PATCH v2] " Dirk Gouders
  0 siblings, 1 reply; 4+ messages in thread
From: Yann E. MORIN @ 2013-05-19 15:12 UTC (permalink / raw)
  To: Dirk Gouders; +Cc: linux-kbuild

Dirk, All,

On 2013-05-17 10: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 "/".

Yes, thank you!

> 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(-)
> 
> diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c
> index 48d382e..f5aff9c 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()) {

item_count() returns a number, not true/false, so you have to use it
thus:
    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..ccb71ae 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()) {

Ditto.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] mconf: handle keys in empty dialogs
  2013-05-19 15:12 ` Yann E. MORIN
@ 2013-05-19 19:48   ` Dirk Gouders
  2013-05-20 15:51     ` Yann E. MORIN
  0 siblings, 1 reply; 4+ messages in thread
From: Dirk Gouders @ 2013-05-19 19:48 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: linux-kbuild

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(-)

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)
-- 
1.8.2.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] mconf: handle keys in empty dialogs
  2013-05-19 19:48   ` [PATCH v2] " Dirk Gouders
@ 2013-05-20 15:51     ` Yann E. MORIN
  0 siblings, 0 replies; 4+ messages in thread
From: Yann E. MORIN @ 2013-05-20 15:51 UTC (permalink / raw)
  To: Dirk Gouders; +Cc: linux-kbuild

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.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-05-20 15:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-17  8:48 [PATCH] mconf: handle keys in empty dialogs Dirk Gouders
2013-05-19 15:12 ` Yann E. MORIN
2013-05-19 19:48   ` [PATCH v2] " Dirk Gouders
2013-05-20 15:51     ` Yann E. MORIN

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.