Skip to content

Commit

Permalink
mconf: handle keys in empty dialogs
Browse files Browse the repository at this point in the history
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>
[yann.morin.1998@free.fr: keep lines <80 chars, so reorder test]
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
  • Loading branch information
dgouders authored and yann-morin-1998 committed May 29, 2013
1 parent 57a9c76 commit 063f466
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
9 changes: 5 additions & 4 deletions scripts/kconfig/lxdialog/menubox.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,11 @@ int dialog_menu(const char *title, const char *prompt,
}
}

if (i < max_choice ||
key == KEY_UP || key == KEY_DOWN ||
key == '-' || key == '+' ||
key == KEY_PPAGE || key == KEY_NPAGE) {
if (item_count() != 0 &&
(i < max_choice ||
key == KEY_UP || key == KEY_DOWN ||
key == '-' || key == '+' ||
key == KEY_PPAGE || key == KEY_NPAGE)) {
/* Remove highligt of current item */
print_item(scroll + choice, choice, FALSE);

Expand Down
11 changes: 6 additions & 5 deletions scripts/kconfig/mconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 063f466

Please sign in to comment.