aboutsummaryrefslogtreecommitdiffstats
path: root/com32/menu/menumain.c
diff options
context:
space:
mode:
Diffstat (limited to 'com32/menu/menumain.c')
-rw-r--r--com32/menu/menumain.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/com32/menu/menumain.c b/com32/menu/menumain.c
index 0c392646..b04c70b0 100644
--- a/com32/menu/menumain.c
+++ b/com32/menu/menumain.c
@@ -754,6 +754,7 @@ static const char *run_menu(void)
const char *cmdline = NULL;
volatile clock_t key_timeout, timeout_left, this_timeout;
const struct menu_entry *me;
+ bool hotkey = false;
/* Note: for both key_timeout and timeout == 0 means no limit */
timeout_left = key_timeout = cm->timeout;
@@ -853,15 +854,23 @@ static const char *run_menu(void)
to_clear = 0;
}
- this_timeout = min(min(key_timeout, timeout_left), (clock_t) CLK_TCK);
- key = mygetkey(this_timeout);
+ if (hotkey && me->immediate) {
+ /* If the hotkey was flagged immediate, simulate pressing ENTER */
+ key = KEY_ENTER;
+ } else {
+ this_timeout = min(min(key_timeout, timeout_left),
+ (clock_t) CLK_TCK);
+ key = mygetkey(this_timeout);
- if (key != KEY_NONE) {
- timeout_left = key_timeout;
- if (to_clear)
- printf("\033[%d;1H\1#0\033[K", TIMEOUT_ROW);
+ if (key != KEY_NONE) {
+ timeout_left = key_timeout;
+ if (to_clear)
+ printf("\033[%d;1H\1#0\033[K", TIMEOUT_ROW);
+ }
}
+ hotkey = false;
+
switch (key) {
case KEY_NONE: /* Timeout */
/* This is somewhat hacky, but this at least lets the user
@@ -1072,6 +1081,7 @@ static const char *run_menu(void)
key_timeout = 0;
entry = cm->menu_hotkeys[key]->entry;
/* Should we commit at this point? */
+ hotkey = true;
}
}
break;