[dynui] Allow for duplicate shortcut keys
When searching for a shortcut key, search first from the currently selected menu item and then from the start of the list. This allows several ways for a shortcut key to be meaningfully used multiple times within the same menu. For example, two sections may have the same shortcut key: item --key s --gap (S)ection 1 item ... item ... item --key s --gap (S)ection 2 item ... With the above menu, repeated "s" keypresses would cycle through the sections. As another example, entries within different sections may have the same shortcut keys. For example: item --key d --gap (D)ebian item --key s debst Debian (s)table release item --key u debun Debian (u)nstable release item --key f --gap (F)edora item --key s fedst Fedora (s)table release item --key u fedun Fedora (u)nstable release With the above menu, a shortcut key sequence such as "f", "s" can be used to select an entry within a specific section, avoiding the need to choose shortcut keys that are globally unique within the menu. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -59,7 +59,7 @@ extern struct dynamic_ui * find_dynui ( const char *name );
|
||||
extern struct dynamic_item * dynui_item ( struct dynamic_ui *dynui,
|
||||
unsigned int index );
|
||||
extern struct dynamic_item * dynui_shortcut ( struct dynamic_ui *dynui,
|
||||
int key );
|
||||
int key, unsigned int index );
|
||||
extern int show_menu ( struct dynamic_ui *dynui, unsigned long timeout,
|
||||
unsigned long retimeout, const char *select,
|
||||
struct dynamic_item **selected );
|
||||
|
||||
Reference in New Issue
Block a user