summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/menu.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/common/menu.c b/common/menu.c
index cb2a6fe..0f5df2c 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -343,6 +343,9 @@ int menu_show(struct menu *m)
gotoXY(m->selected->num + 1, 3);
do {
+ struct menu_entry *old_selected = m->selected;
+ int repaint = 0;
+
if (m->auto_select >= 0)
ch = KEY_RETURN;
else
@@ -352,24 +355,22 @@ int menu_show(struct menu *m)
switch (ch) {
case KEY_UP:
- print_menu_entry(m, m->selected, 0);
m->selected = list_entry(m->selected->list.prev, struct menu_entry,
list);
if (&(m->selected->list) == &(m->entries)) {
m->selected = list_entry(m->selected->list.prev, struct menu_entry,
list);
}
- print_menu_entry(m, m->selected, 1);
+ repaint = 1;
break;
case KEY_DOWN:
- print_menu_entry(m, m->selected, 0);
m->selected = list_entry(m->selected->list.next, struct menu_entry,
list);
if (&(m->selected->list) == &(m->entries)) {
m->selected = list_entry(m->selected->list.next, struct menu_entry,
list);
}
- print_menu_entry(m, m->selected, 1);
+ repaint = 1;
break;
case ' ':
if (m->selected->type != MENU_ENTRY_BOX)
@@ -377,7 +378,7 @@ int menu_show(struct menu *m)
m->selected->box_state = !m->selected->box_state;
if (m->selected->action)
m->selected->action(m, m->selected);
- print_menu_entry(m, m->selected, 1);
+ repaint = 1;
break;
case KEY_ENTER:
if (ch_previous == KEY_RETURN)
@@ -395,6 +396,12 @@ int menu_show(struct menu *m)
default:
break;
}
+
+ if (repaint) {
+ print_menu_entry(m, old_selected, 0);
+ print_menu_entry(m, m->selected, 1);
+ }
+
ch_previous = ch;
} while(1);