* [PATCH 1/1] menu: add number key support
@ 2012-08-05 5:06 Jean-Christophe PLAGNIOL-VILLARD
2012-08-09 6:40 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-08-05 5:06 UTC (permalink / raw)
To: barebox
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>
---
| 17 +++++++++++++++++
1 file changed, 17 insertions(+)
--git a/common/menu.c b/common/menu.c
index 9f536d6..97c6b18 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -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);
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] menu: add number key support
2012-08-05 5:06 [PATCH 1/1] menu: add number key support Jean-Christophe PLAGNIOL-VILLARD
@ 2012-08-09 6:40 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2012-08-09 6:40 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox
On Sun, Aug 05, 2012 at 07:06:00AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> 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>
Applied, thanks
Sascha
> ---
> common/menu.c | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/common/menu.c b/common/menu.c
> index 9f536d6..97c6b18 100644
> --- a/common/menu.c
> +++ b/common/menu.c
> @@ -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);
> --
> 1.7.10.4
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
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-08-09 6:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-05 5:06 [PATCH 1/1] menu: add number key support Jean-Christophe PLAGNIOL-VILLARD
2012-08-09 6:40 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox