menu: add number key support
Allow to use the number key to jump to entry. if already on a entry % number_key jump to the next +10 one if exit Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
21ea2ad830
commit
0e21e17614
|
@ -314,6 +314,23 @@ int menu_show(struct menu *m)
|
|||
m->auto_select = -1;
|
||||
|
||||
switch (ch) {
|
||||
case '0' ... '9': {
|
||||
struct menu_entry *me;
|
||||
int num = ch - '0';
|
||||
int next_num = m->selected->num + 10;
|
||||
if (!num)
|
||||
num = 10;
|
||||
|
||||
if (ch_previous == ch && next_num <= m->nb_entries)
|
||||
num = next_num;
|
||||
|
||||
me = menu_entry_get_by_num(m, num);
|
||||
if (me) {
|
||||
m->selected = me;
|
||||
repaint = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case KEY_UP:
|
||||
m->selected = list_entry(m->selected->list.prev, struct menu_entry,
|
||||
list);
|
||||
|
|
Loading…
Reference in New Issue