summaryrefslogtreecommitdiffstats
path: root/src/hci/tui
diff options
context:
space:
mode:
authorMichael Brown2011-03-23 02:49:00 +0100
committerMichael Brown2011-03-23 02:51:02 +0100
commitf0cd4abd0780606e04b007251e91621695ba259b (patch)
tree12541b5261b7398daf1effea850ec7169baaf10e /src/hci/tui
parent[settings] Add hierarchy navigation in "config" user interface (diff)
downloadipxe-f0cd4abd0780606e04b007251e91621695ba259b.tar.gz
ipxe-f0cd4abd0780606e04b007251e91621695ba259b.tar.xz
ipxe-f0cd4abd0780606e04b007251e91621695ba259b.zip
[settings] Return to first row on navigating to a new settings block
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/hci/tui')
-rw-r--r--src/hci/tui/settings_ui.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/hci/tui/settings_ui.c b/src/hci/tui/settings_ui.c
index b40cd0af..b33d929a 100644
--- a/src/hci/tui/settings_ui.c
+++ b/src/hci/tui/settings_ui.c
@@ -444,6 +444,7 @@ static void init_widget ( struct setting_widget *widget,
static int main_loop ( struct settings *settings ) {
struct setting_widget widget;
int redraw = 1;
+ int move;
unsigned int next;
int key;
int rc;
@@ -497,15 +498,15 @@ static int main_loop ( struct settings *settings ) {
/* Process keypress */
key = getkey ( 0 );
- next = widget.current;
+ move = 0;
switch ( key ) {
case KEY_DOWN:
if ( widget.current < ( widget.num_rows - 1 ) )
- next++;
+ move = +1;
break;
case KEY_UP:
if ( widget.current > 0 )
- next--;
+ move = -1;
break;
case CTRL_D:
if ( ! widget.row.setting )
@@ -534,7 +535,8 @@ static int main_loop ( struct settings *settings ) {
}
break;
}
- if ( next != widget.current ) {
+ if ( move ) {
+ next = ( widget.current + move );
draw_setting_row ( &widget );
redraw = 1;
reveal_setting_row ( &widget, next );