Skip to content

Commit 063f466

Browse files
dgoudersyann-morin-1998
authored andcommitted
mconf: handle keys in empty dialogs
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>
1 parent 57a9c76 commit 063f466

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

‎scripts/kconfig/lxdialog/menubox.c‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,11 @@ int dialog_menu(const char *title, const char *prompt,
303303
}
304304
}
305305

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

‎scripts/kconfig/mconf.c‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -670,11 +670,12 @@ static void conf(struct menu *menu, struct menu *active_menu)
670670
active_menu, &s_scroll);
671671
if (res == 1 || res == KEY_ESC || res == -ERRDISPLAYTOOSMALL)
672672
break;
673-
if (!item_activate_selected())
674-
continue;
675-
if (!item_tag())
676-
continue;
677-
673+
if (item_count() != 0) {
674+
if (!item_activate_selected())
675+
continue;
676+
if (!item_tag())
677+
continue;
678+
}
678679
submenu = item_data();
679680
active_menu = item_data();
680681
if (submenu)

0 commit comments

Comments
 (0)