summaryrefslogtreecommitdiffstats
path: root/src/hci/tui
diff options
context:
space:
mode:
authorMichael Brown2013-07-15 11:59:13 +0200
committerMichael Brown2013-07-15 12:01:08 +0200
commit75bd5b54a8673ea4843903d0e7c743aa5b440d38 (patch)
treee472c1584821bec81d89f424e231b688b3e51454 /src/hci/tui
parent[velocity] Rewrite VIA Velocity driver (diff)
downloadipxe-75bd5b54a8673ea4843903d0e7c743aa5b440d38.tar.gz
ipxe-75bd5b54a8673ea4843903d0e7c743aa5b440d38.tar.xz
ipxe-75bd5b54a8673ea4843903d0e7c743aa5b440d38.zip
[settings] Add support for navigation keys in "config" user interface
Add support for page up, page down, home and end keys, matching the navigation logic used in the menu user interface. Originally-implemented-by: Marin Hannache <git@mareo.fr> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/hci/tui')
-rw-r--r--src/hci/tui/settings_ui.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/src/hci/tui/settings_ui.c b/src/hci/tui/settings_ui.c
index eb82ae54..f7efbbb4 100644
--- a/src/hci/tui/settings_ui.c
+++ b/src/hci/tui/settings_ui.c
@@ -508,13 +508,25 @@ static int main_loop ( struct settings *settings ) {
key = getkey ( 0 );
move = 0;
switch ( key ) {
+ case KEY_UP:
+ move = -1;
+ break;
case KEY_DOWN:
- if ( widget.current < ( widget.num_rows - 1 ) )
- move = +1;
+ move = +1;
break;
- case KEY_UP:
- if ( widget.current > 0 )
- move = -1;
+ case KEY_PPAGE:
+ move = ( widget.first_visible -
+ widget.current - 1 );
+ break;
+ case KEY_NPAGE:
+ move = ( widget.first_visible - widget.current
+ + SETTINGS_LIST_ROWS );
+ break;
+ case KEY_HOME:
+ move = -widget.num_rows;
+ break;
+ case KEY_END:
+ move = +widget.num_rows;
break;
case CTRL_D:
if ( ! widget.row.setting )
@@ -545,10 +557,16 @@ static int main_loop ( struct settings *settings ) {
}
if ( move ) {
next = ( widget.current + move );
- draw_setting_row ( &widget );
- redraw = 1;
- reveal_setting_row ( &widget, next );
- select_setting_row ( &widget, next );
+ if ( ( int ) next < 0 )
+ next = 0;
+ if ( next >= widget.num_rows )
+ next = ( widget.num_rows - 1 );
+ if ( next != widget.current ) {
+ draw_setting_row ( &widget );
+ redraw = 1;
+ reveal_setting_row ( &widget, next );
+ select_setting_row ( &widget, next );
+ }
}
}
}