* [PATCH] menu: add vi like key support
@ 2016-04-15 3:37 DU HUANPENG
0 siblings, 0 replies; 6+ messages in thread
From: DU HUANPENG @ 2016-04-15 3:37 UTC (permalink / raw)
To: barebox; +Cc: Du Huanpeng
From: Du Huanpeng <u74147@gmail.com>
add vi like key support:
j: down
k: up
<Space>: select
Signed-off-by: Du Huanpeng <u74147@gmail.com>
---
| 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
--git a/common/menu.c b/common/menu.c
index 54f2c71..51b4cfc 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -327,6 +327,7 @@ int menu_show(struct menu *m)
}
break;
}
+ case 'k':
case BB_KEY_UP:
m->selected = list_entry(m->selected->list.prev, struct menu_entry,
list);
@@ -336,6 +337,7 @@ int menu_show(struct menu *m)
}
repaint = 1;
break;
+ case 'j':
case BB_KEY_DOWN:
m->selected = list_entry(m->selected->list.next, struct menu_entry,
list);
@@ -346,13 +348,13 @@ int menu_show(struct menu *m)
repaint = 1;
break;
case ' ':
- if (m->selected->type != MENU_ENTRY_BOX)
- break;
- m->selected->box_state = !m->selected->box_state;
- if (m->selected->action)
- m->selected->action(m, m->selected);
- repaint = 1;
- break;
+ if (m->selected->type == MENU_ENTRY_BOX) {
+ m->selected->box_state = !m->selected->box_state;
+ if (m->selected->action)
+ m->selected->action(m, m->selected);
+ repaint = 1;
+ }
+ /* no break */
case BB_KEY_ENTER:
if (ch_previous == BB_KEY_RETURN)
break;
--
1.9.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] menu: add vi like key support
@ 2016-04-15 4:01 DU HUANPENG
0 siblings, 0 replies; 6+ messages in thread
From: DU HUANPENG @ 2016-04-15 4:01 UTC (permalink / raw)
To: barebox; +Cc: Du Huanpeng
From: Du Huanpeng <u74147@gmail.com>
add vi like key support:
j: down
k: up
<Space>: select
Signed-off-by: Du Huanpeng <u74147@gmail.com>
---
| 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
--git a/common/menu.c b/common/menu.c
index 54f2c71..51b4cfc 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -327,6 +327,7 @@ int menu_show(struct menu *m)
}
break;
}
+ case 'k':
case BB_KEY_UP:
m->selected = list_entry(m->selected->list.prev, struct menu_entry,
list);
@@ -336,6 +337,7 @@ int menu_show(struct menu *m)
}
repaint = 1;
break;
+ case 'j':
case BB_KEY_DOWN:
m->selected = list_entry(m->selected->list.next, struct menu_entry,
list);
@@ -346,13 +348,13 @@ int menu_show(struct menu *m)
repaint = 1;
break;
case ' ':
- if (m->selected->type != MENU_ENTRY_BOX)
- break;
- m->selected->box_state = !m->selected->box_state;
- if (m->selected->action)
- m->selected->action(m, m->selected);
- repaint = 1;
- break;
+ if (m->selected->type == MENU_ENTRY_BOX) {
+ m->selected->box_state = !m->selected->box_state;
+ if (m->selected->action)
+ m->selected->action(m, m->selected);
+ repaint = 1;
+ }
+ /* no break */
case BB_KEY_ENTER:
if (ch_previous == BB_KEY_RETURN)
break;
--
1.9.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] menu: add vi like key support
@ 2016-04-15 4:02 DU HUANPENG
0 siblings, 0 replies; 6+ messages in thread
From: DU HUANPENG @ 2016-04-15 4:02 UTC (permalink / raw)
To: barebox; +Cc: Du Huanpeng
From: Du Huanpeng <u74147@gmail.com>
add vi like key support:
j: down
k: up
<Space>: select
Signed-off-by: Du Huanpeng <u74147@gmail.com>
---
| 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
--git a/common/menu.c b/common/menu.c
index 54f2c71..51b4cfc 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -327,6 +327,7 @@ int menu_show(struct menu *m)
}
break;
}
+ case 'k':
case BB_KEY_UP:
m->selected = list_entry(m->selected->list.prev, struct menu_entry,
list);
@@ -336,6 +337,7 @@ int menu_show(struct menu *m)
}
repaint = 1;
break;
+ case 'j':
case BB_KEY_DOWN:
m->selected = list_entry(m->selected->list.next, struct menu_entry,
list);
@@ -346,13 +348,13 @@ int menu_show(struct menu *m)
repaint = 1;
break;
case ' ':
- if (m->selected->type != MENU_ENTRY_BOX)
- break;
- m->selected->box_state = !m->selected->box_state;
- if (m->selected->action)
- m->selected->action(m, m->selected);
- repaint = 1;
- break;
+ if (m->selected->type == MENU_ENTRY_BOX) {
+ m->selected->box_state = !m->selected->box_state;
+ if (m->selected->action)
+ m->selected->action(m, m->selected);
+ repaint = 1;
+ }
+ /* no break */
case BB_KEY_ENTER:
if (ch_previous == BB_KEY_RETURN)
break;
--
1.9.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] menu: add vi like key support
@ 2016-04-15 4:06 DU HUANPENG
0 siblings, 0 replies; 6+ messages in thread
From: DU HUANPENG @ 2016-04-15 4:06 UTC (permalink / raw)
To: barebox; +Cc: Du Huanpeng
From: Du Huanpeng <u74147@gmail.com>
add vi like key support:
j: down
k: up
<Space>: select
Signed-off-by: Du Huanpeng <u74147@gmail.com>
---
| 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
--git a/common/menu.c b/common/menu.c
index 54f2c71..9819569 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -327,6 +327,7 @@ int menu_show(struct menu *m)
}
break;
}
+ case 'k':
case BB_KEY_UP:
m->selected = list_entry(m->selected->list.prev, struct menu_entry,
list);
@@ -336,6 +337,7 @@ int menu_show(struct menu *m)
}
repaint = 1;
break;
+ case 'j':
case BB_KEY_DOWN:
m->selected = list_entry(m->selected->list.next, struct menu_entry,
list);
@@ -346,13 +348,14 @@ int menu_show(struct menu *m)
repaint = 1;
break;
case ' ':
- if (m->selected->type != MENU_ENTRY_BOX)
+ if (m->selected->type == MENU_ENTRY_BOX) {
+ m->selected->box_state = !m->selected->box_state;
+ if (m->selected->action)
+ m->selected->action(m, m->selected);
+ repaint = 1;
break;
- m->selected->box_state = !m->selected->box_state;
- if (m->selected->action)
- m->selected->action(m, m->selected);
- repaint = 1;
- break;
+ }
+ /* no break */
case BB_KEY_ENTER:
if (ch_previous == BB_KEY_RETURN)
break;
--
1.9.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] menu: add vi like key support
@ 2016-04-19 4:02 DU HUANPENG
2016-04-19 6:13 ` Sascha Hauer
0 siblings, 1 reply; 6+ messages in thread
From: DU HUANPENG @ 2016-04-19 4:02 UTC (permalink / raw)
To: barebox; +Cc: Du Huanpeng
From: Du Huanpeng <u74147@gmail.com>
add vi like key support:
j: down
k: up
<Space>: select
Signed-off-by: Du Huanpeng <u74147@gmail.com>
---
| 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
--git a/common/menu.c b/common/menu.c
index 54f2c71..9819569 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -327,6 +327,7 @@ int menu_show(struct menu *m)
}
break;
}
+ case 'k':
case BB_KEY_UP:
m->selected = list_entry(m->selected->list.prev, struct menu_entry,
list);
@@ -336,6 +337,7 @@ int menu_show(struct menu *m)
}
repaint = 1;
break;
+ case 'j':
case BB_KEY_DOWN:
m->selected = list_entry(m->selected->list.next, struct menu_entry,
list);
@@ -346,13 +348,14 @@ int menu_show(struct menu *m)
repaint = 1;
break;
case ' ':
- if (m->selected->type != MENU_ENTRY_BOX)
+ if (m->selected->type == MENU_ENTRY_BOX) {
+ m->selected->box_state = !m->selected->box_state;
+ if (m->selected->action)
+ m->selected->action(m, m->selected);
+ repaint = 1;
break;
- m->selected->box_state = !m->selected->box_state;
- if (m->selected->action)
- m->selected->action(m, m->selected);
- repaint = 1;
- break;
+ }
+ /* no break */
case BB_KEY_ENTER:
if (ch_previous == BB_KEY_RETURN)
break;
--
1.9.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] menu: add vi like key support
2016-04-19 4:02 DU HUANPENG
@ 2016-04-19 6:13 ` Sascha Hauer
0 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2016-04-19 6:13 UTC (permalink / raw)
To: DU HUANPENG; +Cc: barebox, Du Huanpeng
On Tue, Apr 19, 2016 at 12:02:53PM +0800, DU HUANPENG wrote:
> From: Du Huanpeng <u74147@gmail.com>
>
> add vi like key support:
> j: down
> k: up
> <Space>: select
>
> Signed-off-by: Du Huanpeng <u74147@gmail.com>
> ---
> common/menu.c | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
Applied, thanks
Sascha
--
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] 6+ messages in thread
end of thread, other threads:[~2016-04-19 6:13 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-15 3:37 [PATCH] menu: add vi like key support DU HUANPENG
2016-04-15 4:01 DU HUANPENG
2016-04-15 4:02 DU HUANPENG
2016-04-15 4:06 DU HUANPENG
2016-04-19 4:02 DU HUANPENG
2016-04-19 6:13 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox