mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] menu: fix support for "\n", "\n\r" and "\r"
@ 2012-04-23 11:24 Jean-Christophe PLAGNIOL-VILLARD
  2012-04-23 11:24 ` [PATCH 2/2] menu: fix menu alloc init Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 2+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-04-23 11:24 UTC (permalink / raw)
  To: barebox

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

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 common/menu.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/common/menu.c b/common/menu.c
index 83821ec..6c530b6 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -296,7 +296,7 @@ static int menu_alloc_display_buffer(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;
@@ -388,7 +388,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);
@@ -399,6 +404,7 @@ int menu_show(struct menu *m)
 		default:
 			break;
 		}
+		ch_previous = ch;
 	} while(1);
 
 	return 0;
-- 
1.7.9.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 2/2] menu: fix menu alloc init
  2012-04-23 11:24 [PATCH 1/2] menu: fix support for "\n", "\n\r" and "\r" Jean-Christophe PLAGNIOL-VILLARD
@ 2012-04-23 11:24 ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 2+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-04-23 11:24 UTC (permalink / raw)
  To: barebox

The auto_select is supposed to be set to -1.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 include/menu.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/menu.h b/include/menu.h
index 136fe61..74abcfb 100644
--- a/include/menu.h
+++ b/include/menu.h
@@ -79,6 +79,7 @@ static inline struct menu* menu_alloc(void)
 	if (m) {
 		INIT_LIST_HEAD(&m->entries);
 		m->nb_entries = 0;
+		m->auto_select = -1;
 	}
 	return m;
 }
-- 
1.7.9.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-04-23 11:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-23 11:24 [PATCH 1/2] menu: fix support for "\n", "\n\r" and "\r" Jean-Christophe PLAGNIOL-VILLARD
2012-04-23 11:24 ` [PATCH 2/2] menu: fix menu alloc init Jean-Christophe PLAGNIOL-VILLARD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox