9
0
Fork 0

menu: fix support for "\n", "\n\r" and "\r"

If "\n\r" or "\r\n" is ignore one.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
This commit is contained in:
Jean-Christophe PLAGNIOL-VILLARD 2012-04-23 19:12:31 +08:00
parent 76c9becdc2
commit eb7667b681
1 changed files with 7 additions and 1 deletions

View File

@ -252,7 +252,7 @@ static void print_menu(struct menu *m)
int menu_show(struct menu *m)
{
int ch;
int ch, ch_previous = 0;
int escape = 0;
int countdown;
int auto_display_len = 16;
@ -339,7 +339,12 @@ int menu_show(struct menu *m)
m->selected->action(m, m->selected);
print_menu_entry(m, m->selected, 1);
break;
case KEY_ENTER:
if (ch_previous == KEY_RETURN)
break;
case KEY_RETURN:
if (ch_previous == KEY_ENTER)
break;
clear();
gotoXY(1,1);
m->selected->action(m, m->selected);
@ -350,6 +355,7 @@ int menu_show(struct menu *m)
default:
break;
}
ch_previous = ch;
} while(1);
return 0;