}
/* Get a single word into a new refstr; advances the input pointer */
-static char *get_word(char *str, const char **word)
+static char *get_word(char *str, char **word)
{
char *p = str;
char *q;
} else if ((ep = looking_at(p, "hidden"))) {
hiddenmenu = 1;
} else if (looking_at(p, "hiddenkey")) {
- const char *key_name;
+ char *key_name, *k, *ek;
+ const char *command;
int key;
p = get_word(skipspace(p + 9), &key_name);
- p = skipspace(p);
- key = key_name_to_code(key_name);
- refstr_put(key_name);
- if (key >= 0) {
- refstr_put(hide_key[key]);
- hide_key[key] = refstrdup(skipspace(p));
+ command = refstrdup(skipspace(p));
+ k = key_name;
+ for (;;) {
+ ek = strchr(k+1, ',');
+ if (ek)
+ *ek = '\0';
+ key = key_name_to_code(k);
+ if (key >= 0) {
+ refstr_put(hide_key[key]);
+ hide_key[key] = refstr_get(command);
+ }
+ if (!ek)
+ break;
+ k = ek+1;
}
+ refstr_put(key_name);
+ refstr_put(command);
} else if ((ep = looking_at(p, "clear"))) {
clearmenu = 1;
} else if ((ep = is_message_name(p, &msgnr))) {
const char *filename;
struct menu *m;
struct menu_entry *me;
+ int k;
empty_string = refstrdup("");
if (m->onerror)
m->onerror = unlabel(m->onerror);
}
+
+ /* Final global initialization, with all labels known */
+ for (k = 0; k < KEY_MAX; k++) {
+ if (hide_key[k])
+ hide_key[k] = unlabel(hide_key[k]);
+ }
}
All that is displayed is a timeout message.
-MENU HIDDENKEY key command...
+MENU HIDDENKEY key[,key...] command...
If they key used to interrupt MENU HIDDEN is <key>, then
execute the specified command instead of displaying the menu.
... in addition to all single characters plus the syntax ^X
for Ctrl-X. Note that single characters are treated as case
sensitive, so a different command can be bound to "A" than
- "a".
-
+ "a". One can bind the same command to multiple keys by giving
+ a comma-separated list of keys:
+
+ menu hiddenkey A,a key_a_command
+
MENU CLEAR