diff options
author | Michael Brown <mcb30@ipxe.org> | 2024-06-20 12:21:57 -0700 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2024-06-20 13:14:35 -0700 |
commit | 122777f789a68512593e4aa6da3ace3d0d8664ec (patch) | |
tree | 25e8fc721b355c45e6e10d53f9866e32369f05b2 /src/hci/tui/menu_ui.c | |
parent | 76e0933d781474acf52000cba0afaebe32361667 (diff) | |
download | ipxe-122777f789a68512593e4aa6da3ace3d0d8664ec.tar.gz |
[hci] Allow tab key to be used to cycle through UI elements
Add support for wraparound scrolling and allow the tab key to be used
to move forward through a list of elements, wrapping back around to
the beginning of the list on overflow.
This is mildly useful for a menu, and likely to be a strong user
expectation for an interactive form.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/hci/tui/menu_ui.c')
-rw-r--r-- | src/hci/tui/menu_ui.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/hci/tui/menu_ui.c b/src/hci/tui/menu_ui.c index cac61a7da..067e2d8ca 100644 --- a/src/hci/tui/menu_ui.c +++ b/src/hci/tui/menu_ui.c @@ -175,9 +175,9 @@ static int menu_loop ( struct menu_ui *ui, struct menu_item **selected ) { struct menu_item *item; unsigned long timeout; unsigned int previous; + unsigned int move; int key; int i; - int move; int chosen = 0; int rc = 0; @@ -192,7 +192,7 @@ static int menu_loop ( struct menu_ui *ui, struct menu_item **selected ) { ui->timeout -= timeout; /* Get key */ - move = 0; + move = SCROLL_NONE; key = getkey ( timeout ); if ( key < 0 ) { /* Choose default if we finally time out */ @@ -228,7 +228,7 @@ static int menu_loop ( struct menu_ui *ui, struct menu_item **selected ) { if ( item->name ) { chosen = 1; } else { - move = +1; + move = SCROLL_DOWN; } } break; |