mirror of https://github.com/ipxe/ipxe.git
[settings] Return to first row on navigating to a new settings block
Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/1/head
parent
da312ba03b
commit
f0cd4abd07
|
|
@ -444,6 +444,7 @@ static void init_widget ( struct setting_widget *widget,
|
||||||
static int main_loop ( struct settings *settings ) {
|
static int main_loop ( struct settings *settings ) {
|
||||||
struct setting_widget widget;
|
struct setting_widget widget;
|
||||||
int redraw = 1;
|
int redraw = 1;
|
||||||
|
int move;
|
||||||
unsigned int next;
|
unsigned int next;
|
||||||
int key;
|
int key;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
@ -497,15 +498,15 @@ static int main_loop ( struct settings *settings ) {
|
||||||
|
|
||||||
/* Process keypress */
|
/* Process keypress */
|
||||||
key = getkey ( 0 );
|
key = getkey ( 0 );
|
||||||
next = widget.current;
|
move = 0;
|
||||||
switch ( key ) {
|
switch ( key ) {
|
||||||
case KEY_DOWN:
|
case KEY_DOWN:
|
||||||
if ( widget.current < ( widget.num_rows - 1 ) )
|
if ( widget.current < ( widget.num_rows - 1 ) )
|
||||||
next++;
|
move = +1;
|
||||||
break;
|
break;
|
||||||
case KEY_UP:
|
case KEY_UP:
|
||||||
if ( widget.current > 0 )
|
if ( widget.current > 0 )
|
||||||
next--;
|
move = -1;
|
||||||
break;
|
break;
|
||||||
case CTRL_D:
|
case CTRL_D:
|
||||||
if ( ! widget.row.setting )
|
if ( ! widget.row.setting )
|
||||||
|
|
@ -534,7 +535,8 @@ static int main_loop ( struct settings *settings ) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ( next != widget.current ) {
|
if ( move ) {
|
||||||
|
next = ( widget.current + move );
|
||||||
draw_setting_row ( &widget );
|
draw_setting_row ( &widget );
|
||||||
redraw = 1;
|
redraw = 1;
|
||||||
reveal_setting_row ( &widget, next );
|
reveal_setting_row ( &widget, next );
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue