2 * Copyright (C) 1996-2000,2002 Michael R. Elkins <me@mutt.org>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 #include "mutt_menu.h"
25 #include "mutt_curses.h"
28 #include "mutt_crypt.h"
30 #include "imap/imap.h"
37 #include "functions.h"
39 struct mapping_t Menus[] = {
40 { "alias", MENU_ALIAS },
41 { "attach", MENU_ATTACH },
42 { "browser", MENU_FOLDER },
43 { "compose", MENU_COMPOSE },
44 { "editor", MENU_EDITOR },
45 { "index", MENU_MAIN },
46 { "pager", MENU_PAGER },
47 { "postpone", MENU_POST },
49 { "smime", MENU_SMIME },
50 #ifdef CRYPT_BACKEND_GPGME
51 { "key_select_pgp", MENU_KEY_SELECT_PGP },
52 { "key_select_smime", MENU_KEY_SELECT_SMIME },
60 { "query", MENU_QUERY },
61 { "generic", MENU_GENERIC },
65 #define mutt_check_menu(s) mutt_getvaluebyname(s, Menus)
67 static struct mapping_t KeyNames[] = {
68 { "<PageUp>", KEY_PPAGE },
69 { "<PageDown>", KEY_NPAGE },
71 { "<Down>", KEY_DOWN },
72 { "<Right>", KEY_RIGHT },
73 { "<Left>", KEY_LEFT },
74 { "<Delete>", KEY_DC },
75 { "<BackSpace>",KEY_BACKSPACE },
76 { "<Insert>", KEY_IC },
77 { "<Home>", KEY_HOME },
80 { "<Enter>", KEY_ENTER },
82 { "<Return>", M_ENTER_C },
87 { "<BackTab>", KEY_BTAB },
90 { "<Next>", KEY_NEXT },
92 #ifdef NCURSES_VERSION
93 /* extensions supported by ncurses. values are filled in during initialization */
124 #endif /* NCURSES_VERSION */
128 /* contains the last key the user pressed */
131 struct keymap_t *Keymaps[MENU_MAX];
133 static struct keymap_t *allocKeys (int len, keycode_t *keys)
137 p = safe_calloc (1, sizeof (struct keymap_t));
139 p->keys = safe_malloc (len * sizeof (keycode_t));
140 memcpy (p->keys, keys, len * sizeof (keycode_t));
144 static int parse_fkey(char *s)
149 if(s[0] != '<' || ascii_tolower(s[1]) != 'f')
152 for(t = s + 2; *t && isdigit((unsigned char) *t); t++)
165 * This function parses the string <NNN> and uses the octal value as the key
168 static int parse_keycode (const char *s)
171 long int result = strtol(s+1, &endChar, 8);
172 /* allow trailing whitespace, eg. < 1001 > */
173 while (ISSPACE(*endChar))
175 /* negative keycodes don't make sense, also detect overflow */
176 if (*endChar != '>' || result < 0 || result == LONG_MAX) {
182 static int parsekeys (const char *str, keycode_t *d, int max)
185 char buff[SHORT_STRING];
189 strfcpy(buff, str, sizeof(buff));
195 if(*s == '<' && (t = strchr(s, '>')))
197 t++; c = *t; *t = '\0';
199 if ((n = mutt_getvaluebyname (s, KeyNames)) != -1)
204 else if ((n = parse_fkey(s)) > 0)
209 else if ((n = parse_keycode(s)) > 0)
220 *d = (unsigned char)*s;
230 /* insert a key sequence into the specified map. the map is sorted by ASCII
231 * value (lowest to highest)
233 void km_bind (char *s, int menu, int op, char *macro, char *descr)
235 struct keymap_t *map, *tmp, *last = NULL, *next;
236 keycode_t buf[MAX_SEQ];
237 int len, pos = 0, lastpos = 0;
239 len = parsekeys (s, buf, MAX_SEQ);
241 map = allocKeys (len, buf);
243 map->macro = safe_strdup (macro);
244 map->descr = safe_strdup (descr);
250 if (pos >= len || pos >= tmp->len)
252 /* map and tmp match, but have different lengths, so overwrite */
263 while (tmp && len >= pos);
267 else if (buf[pos] == tmp->keys[pos])
269 else if (buf[pos] < tmp->keys[pos])
271 /* found location to insert between last and tmp */
275 else /* buf[pos] > tmp->keys[pos] */
295 void km_bindkey (char *s, int menu, int op)
297 km_bind (s, menu, op, NULL, NULL);
300 static int get_op (struct binding_t *bindings, const char *start, size_t len)
304 for (i = 0; bindings[i].name; i++)
306 if (!ascii_strncasecmp (start, bindings[i].name, len) &&
307 mutt_strlen (bindings[i].name) == len)
308 return bindings[i].op;
314 static char *get_func (struct binding_t *bindings, int op)
318 for (i = 0; bindings[i].name; i++)
320 if (bindings[i].op == op)
321 return bindings[i].name;
327 static void push_string (char *s)
329 char *pp, *p = s + mutt_strlen (s) - 1;
335 /* if we see something like "<PageUp>", look to see if it is a real
336 function name and return the corresponding value */
339 for (pp = p - 1; pp >= s && *pp != '<'; pp--)
343 if ((i = parse_fkey (pp)) > 0)
345 mutt_ungetch (KEY_F (i), 0);
351 for (i = 0; KeyNames[i].name; i++)
353 if (!ascii_strncasecmp (pp, KeyNames[i].name, l))
356 if (KeyNames[i].name)
359 mutt_ungetch (KeyNames[i].value, 0);
364 /* See if it is a valid command
365 * skip the '<' and the '>' when comparing */
366 for (i = 0; Menus[i].name; i++)
368 struct binding_t *binding = km_get_table (Menus[i].value);
371 op = get_op (binding, pp + 1, l - 2);
379 mutt_ungetch (0, op);
385 mutt_ungetch ((unsigned char)*p--, 0); /* independent 8 bits chars */
389 static int retry_generic (int menu, keycode_t *keys, int keyslen, int lastkey)
391 if (menu != MENU_EDITOR && menu != MENU_GENERIC && menu != MENU_PAGER)
394 mutt_ungetch (lastkey, 0);
395 for (; keyslen; keyslen--)
396 mutt_ungetch (keys[keyslen - 1], 0);
397 return (km_dokey (MENU_GENERIC));
399 if (menu != MENU_EDITOR)
401 /* probably a good idea to flush input here so we can abort macros */
408 * >0 function to execute
409 * OP_NULL no function bound to key sequence
410 * -1 error occured while reading input
412 int km_dokey (int menu)
415 struct keymap_t *map = Keymaps[menu];
421 return (retry_generic (menu, NULL, 0, 0));
425 i = Timeout > 0 ? Timeout : 60;
427 /* keepalive may need to run more frequently than Timeout allows */
430 if (ImapKeepalive >= i)
433 while (ImapKeepalive && ImapKeepalive < i)
435 timeout (ImapKeepalive * 1000);
439 /* something other than timeout */
451 /* hide timeouts from line editor */
452 if (menu == MENU_EDITOR && tmp.ch == -2)
460 /* do we have an op already? */
464 struct binding_t *bindings;
466 /* is this a valid op for this menu? */
467 if ((bindings = km_get_table (menu)) &&
468 (func = get_func (bindings, tmp.op)))
471 if (menu == MENU_EDITOR && get_func (OpEditor, tmp.op))
474 if (menu != MENU_EDITOR && menu != MENU_PAGER)
476 /* check generic menu */
477 bindings = OpGeneric;
478 if ((func = get_func (bindings, tmp.op)))
482 /* Sigh. Valid function but not in this context.
483 * Find the literal string and push it back */
484 for (i = 0; Menus[i].name; i++)
486 bindings = km_get_table (Menus[i].value);
489 func = get_func (bindings, tmp.op);
492 /* careful not to feed the <..> as one token. otherwise
493 * push_string() will push the bogus op right back! */
494 mutt_ungetch ('>', 0);
496 mutt_ungetch ('<', 0);
501 /* continue to chew */
506 /* Nope. Business as usual */
507 while (LastKey > map->keys[pos])
509 if (pos > map->eq || !map->next)
510 return (retry_generic (menu, map->keys, pos, LastKey));
514 if (LastKey != map->keys[pos])
515 return (retry_generic (menu, map->keys, pos, LastKey));
517 if (++pos == map->len)
520 if (map->op != OP_MACRO)
526 mutt_error _("Macro loop detected.");
530 push_string (map->macro);
539 static void create_bindings (struct binding_t *map, int menu)
543 for (i = 0 ; map[i].name ; i++)
545 km_bindkey (map[i].seq, menu, map[i].op);
548 char *km_keyname (int c)
553 if ((p = mutt_getnamebyvalue (c, KeyNames)))
556 if (c < 256 && c > -128 && iscntrl ((unsigned char) c))
564 buf[1] = (c + '@') & 0x7f;
568 snprintf (buf, sizeof (buf), "\\%d%d%d", c >> 6, (c >> 3) & 7, c & 7);
570 else if (c >= KEY_F0 && c < KEY_F(256)) /* this maximum is just a guess */
571 sprintf (buf, "<F%d>", c - KEY_F0);
572 else if (IsPrint (c))
573 snprintf (buf, sizeof (buf), "%c", (unsigned char) c);
575 snprintf (buf, sizeof (buf), "\\x%hx", (unsigned short) c);
579 int km_expand_key (char *s, size_t len, struct keymap_t *map)
589 strfcpy (s, km_keyname (map->keys[p]), len);
590 len -= (l = mutt_strlen (s));
592 if (++p >= map->len || !len)
601 struct keymap_t *km_find_func (int menu, int func)
603 struct keymap_t *map = Keymaps[menu];
605 for (; map; map = map->next)
611 #ifdef NCURSES_VERSION
617 static const struct extkey ExtKeys[] = {
618 { "<c-up>", "kUP5" },
620 { "<a-up>", "kUP3" },
622 { "<s-down>", "kDN" },
623 { "<a-down>", "kDN3" },
624 { "<c-down>", "kDN5" },
626 { "<c-right>", "kRIT5" },
627 { "<s-right>", "kRIT" },
628 { "<a-right>", "kRIT3" },
630 { "<s-left>", "kLFT" },
631 { "<a-left>", "kLFT3" },
632 { "<c-left>", "kLFT5" },
634 { "<s-home>", "kHOM" },
635 { "<a-home>", "kHOM3" },
636 { "<c-home>", "kHOM5" },
638 { "<s-end>", "kEND" },
639 { "<a-end>", "kEND3" },
640 { "<c-end>", "kEND5" },
642 { "<s-next>", "kNXT" },
643 { "<a-next>", "kNXT3" },
644 { "<c-next>", "kNXT5" },
646 { "<s-prev>", "kPRV" },
647 { "<a-prev>", "kPRV3" },
648 { "<c-prev>", "kPRV5" },
653 /* Look up Mutt's name for a key and find the ncurses extended name for it */
654 static const char *find_ext_name(const char *key)
658 for (j = 0; ExtKeys[j].name; ++j)
660 if (strcasecmp(key, ExtKeys[j].name) == 0)
661 return ExtKeys[j].sym;
665 #endif /* NCURSES_VERSION */
667 /* Determine the keycodes for ncurses extended keys and fill in the KeyNames array.
669 * This function must be called *after* initscr(), or tigetstr() returns -1. This
670 * creates a bit of a chicken-and-egg problem because km_init() is called prior to
671 * start_curses(). This means that the default keybindings can't include any of the
672 * extended keys because they won't be defined until later.
674 void init_extended_keys(void)
676 #ifdef NCURSES_VERSION
679 use_extended_names(TRUE);
681 for (j = 0; KeyNames[j].name; ++j)
683 if (KeyNames[j].value == -1)
685 const char *keyname = find_ext_name(KeyNames[j].name);
689 char *s = tigetstr(keyname);
690 if (s && (long)(s) != -1)
692 int code = key_defined(s);
694 KeyNames[j].value = code;
704 memset (Keymaps, 0, sizeof (struct keymap_t *) * MENU_MAX);
706 create_bindings (OpAttach, MENU_ATTACH);
707 create_bindings (OpBrowser, MENU_FOLDER);
708 create_bindings (OpCompose, MENU_COMPOSE);
709 create_bindings (OpMain, MENU_MAIN);
710 create_bindings (OpPager, MENU_PAGER);
711 create_bindings (OpPost, MENU_POST);
712 create_bindings (OpQuery, MENU_QUERY);
713 create_bindings (OpAlias, MENU_ALIAS);
716 if ((WithCrypto & APPLICATION_PGP))
717 create_bindings (OpPgp, MENU_PGP);
719 if ((WithCrypto & APPLICATION_SMIME))
720 create_bindings (OpSmime, MENU_SMIME);
722 #ifdef CRYPT_BACKEND_GPGME
723 create_bindings (OpPgp, MENU_KEY_SELECT_PGP);
724 create_bindings (OpSmime, MENU_KEY_SELECT_SMIME);
728 create_bindings (OpMix, MENU_MIX);
730 km_bindkey ("<space>", MENU_MIX, OP_GENERIC_SELECT_ENTRY);
731 km_bindkey ("h", MENU_MIX, OP_MIX_CHAIN_PREV);
732 km_bindkey ("l", MENU_MIX, OP_MIX_CHAIN_NEXT);
735 /* bindings for the line editor */
736 create_bindings (OpEditor, MENU_EDITOR);
738 km_bindkey ("<up>", MENU_EDITOR, OP_EDITOR_HISTORY_UP);
739 km_bindkey ("<down>", MENU_EDITOR, OP_EDITOR_HISTORY_DOWN);
740 km_bindkey ("<left>", MENU_EDITOR, OP_EDITOR_BACKWARD_CHAR);
741 km_bindkey ("<right>", MENU_EDITOR, OP_EDITOR_FORWARD_CHAR);
742 km_bindkey ("<home>", MENU_EDITOR, OP_EDITOR_BOL);
743 km_bindkey ("<end>", MENU_EDITOR, OP_EDITOR_EOL);
744 km_bindkey ("<backspace>", MENU_EDITOR, OP_EDITOR_BACKSPACE);
745 km_bindkey ("<delete>", MENU_EDITOR, OP_EDITOR_BACKSPACE);
746 km_bindkey ("\177", MENU_EDITOR, OP_EDITOR_BACKSPACE);
748 /* generic menu keymap */
749 create_bindings (OpGeneric, MENU_GENERIC);
751 km_bindkey ("<home>", MENU_GENERIC, OP_FIRST_ENTRY);
752 km_bindkey ("<end>", MENU_GENERIC, OP_LAST_ENTRY);
753 km_bindkey ("<pagedown>", MENU_GENERIC, OP_NEXT_PAGE);
754 km_bindkey ("<pageup>", MENU_GENERIC, OP_PREV_PAGE);
755 km_bindkey ("<right>", MENU_GENERIC, OP_NEXT_PAGE);
756 km_bindkey ("<left>", MENU_GENERIC, OP_PREV_PAGE);
757 km_bindkey ("<up>", MENU_GENERIC, OP_PREV_ENTRY);
758 km_bindkey ("<down>", MENU_GENERIC, OP_NEXT_ENTRY);
759 km_bindkey ("1", MENU_GENERIC, OP_JUMP);
760 km_bindkey ("2", MENU_GENERIC, OP_JUMP);
761 km_bindkey ("3", MENU_GENERIC, OP_JUMP);
762 km_bindkey ("4", MENU_GENERIC, OP_JUMP);
763 km_bindkey ("5", MENU_GENERIC, OP_JUMP);
764 km_bindkey ("6", MENU_GENERIC, OP_JUMP);
765 km_bindkey ("7", MENU_GENERIC, OP_JUMP);
766 km_bindkey ("8", MENU_GENERIC, OP_JUMP);
767 km_bindkey ("9", MENU_GENERIC, OP_JUMP);
769 km_bindkey ("<enter>", MENU_GENERIC, OP_GENERIC_SELECT_ENTRY);
771 /* Miscellaneous extra bindings */
773 km_bindkey (" ", MENU_MAIN, OP_DISPLAY_MESSAGE);
774 km_bindkey ("<up>", MENU_MAIN, OP_MAIN_PREV_UNDELETED);
775 km_bindkey ("<down>", MENU_MAIN, OP_MAIN_NEXT_UNDELETED);
776 km_bindkey ("J", MENU_MAIN, OP_NEXT_ENTRY);
777 km_bindkey ("K", MENU_MAIN, OP_PREV_ENTRY);
778 km_bindkey ("x", MENU_MAIN, OP_EXIT);
780 km_bindkey ("<enter>", MENU_MAIN, OP_DISPLAY_MESSAGE);
782 km_bindkey ("x", MENU_PAGER, OP_EXIT);
783 km_bindkey ("i", MENU_PAGER, OP_EXIT);
784 km_bindkey ("<backspace>", MENU_PAGER, OP_PREV_LINE);
785 km_bindkey ("<pagedown>", MENU_PAGER, OP_NEXT_PAGE);
786 km_bindkey ("<pageup>", MENU_PAGER, OP_PREV_PAGE);
787 km_bindkey ("<up>", MENU_PAGER, OP_MAIN_PREV_UNDELETED);
788 km_bindkey ("<right>", MENU_PAGER, OP_MAIN_NEXT_UNDELETED);
789 km_bindkey ("<down>", MENU_PAGER, OP_MAIN_NEXT_UNDELETED);
790 km_bindkey ("<left>", MENU_PAGER, OP_MAIN_PREV_UNDELETED);
791 km_bindkey ("<home>", MENU_PAGER, OP_PAGER_TOP);
792 km_bindkey ("<end>", MENU_PAGER, OP_PAGER_BOTTOM);
793 km_bindkey ("1", MENU_PAGER, OP_JUMP);
794 km_bindkey ("2", MENU_PAGER, OP_JUMP);
795 km_bindkey ("3", MENU_PAGER, OP_JUMP);
796 km_bindkey ("4", MENU_PAGER, OP_JUMP);
797 km_bindkey ("5", MENU_PAGER, OP_JUMP);
798 km_bindkey ("6", MENU_PAGER, OP_JUMP);
799 km_bindkey ("7", MENU_PAGER, OP_JUMP);
800 km_bindkey ("8", MENU_PAGER, OP_JUMP);
801 km_bindkey ("9", MENU_PAGER, OP_JUMP);
803 km_bindkey ("<enter>", MENU_PAGER, OP_NEXT_LINE);
805 km_bindkey ("<return>", MENU_ALIAS, OP_GENERIC_SELECT_ENTRY);
806 km_bindkey ("<enter>", MENU_ALIAS, OP_GENERIC_SELECT_ENTRY);
807 km_bindkey ("<space>", MENU_ALIAS, OP_TAG);
809 km_bindkey ("<enter>", MENU_ATTACH, OP_VIEW_ATTACH);
810 km_bindkey ("<enter>", MENU_COMPOSE, OP_VIEW_ATTACH);
812 /* edit-to (default "t") hides generic tag-entry in Compose menu
813 This will bind tag-entry to "T" in the Compose menu */
814 km_bindkey ("T", MENU_COMPOSE, OP_TAG);
817 void km_error_key (int menu)
819 char buf[SHORT_STRING];
820 struct keymap_t *key;
822 if(!(key = km_find_func(menu, OP_HELP)))
823 key = km_find_func(MENU_GENERIC, OP_HELP);
825 if(!(km_expand_key(buf, sizeof(buf), key)))
827 mutt_error _("Key is not bound.");
831 /* make sure the key is really the help key in this menu */
833 if (km_dokey (menu) != OP_HELP)
835 mutt_error _("Key is not bound.");
839 mutt_error (_("Key is not bound. Press '%s' for help."), buf);
843 int mutt_parse_push (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
847 mutt_extract_token (buf, s, M_TOKEN_CONDENSE);
850 strfcpy (err->data, _("push: too many arguments"), err->dsize);
854 push_string (buf->data);
858 /* expects to see: <menu-string>,<menu-string>,... <key-string> */
859 static char *parse_keymap (int *menu, BUFFER *s, int maxmenus, int *nummenus, BUFFER *err)
865 memset (&buf, 0, sizeof (buf));
868 mutt_extract_token (&buf, s, 0);
878 if ((menu[i] = mutt_check_menu (p)) == -1)
880 snprintf (err->data, err->dsize, _("%s: no such menu"), p);
891 mutt_extract_token (&buf, s, 0);
895 strfcpy (err->data, _("null key sequence"), err->dsize);
897 else if (MoreArgs (s))
902 strfcpy (err->data, _("too few arguments"), err->dsize);
910 try_bind (char *key, int menu, char *func, struct binding_t *bindings)
914 for (i = 0; bindings[i].name; i++)
915 if (mutt_strcmp (func, bindings[i].name) == 0)
917 km_bindkey (key, menu, bindings[i].op);
923 struct binding_t *km_get_table (int menu)
949 return (WithCrypto & APPLICATION_PGP)? OpPgp:NULL;
951 #ifdef CRYPT_BACKEND_GPGME
952 case MENU_KEY_SELECT_PGP:
954 case MENU_KEY_SELECT_SMIME:
967 /* bind menu-name '<key_sequence>' function-name */
968 int mutt_parse_bind (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
970 struct binding_t *bindings = NULL;
972 int menu[sizeof(Menus)/sizeof(struct mapping_t)-1], r = 0, nummenus, i;
974 if ((key = parse_keymap (menu, s, sizeof (menu)/sizeof (menu[0]),
975 &nummenus, err)) == NULL)
978 /* function to execute */
979 mutt_extract_token (buf, s, 0);
982 strfcpy (err->data, _("bind: too many arguments"), err->dsize);
985 else if (ascii_strcasecmp ("noop", buf->data) == 0)
987 for (i = 0; i < nummenus; ++i)
989 km_bindkey (key, menu[i], OP_NULL); /* the `unbind' command */
994 for (i = 0; i < nummenus; ++i)
996 /* First check the "generic" list of commands */
997 if (menu[i] == MENU_PAGER || menu[i] == MENU_EDITOR ||
998 menu[i] == MENU_GENERIC ||
999 try_bind (key, menu[i], buf->data, OpGeneric) != 0)
1001 /* Now check the menu-specific list of commands (if they exist) */
1002 bindings = km_get_table (menu[i]);
1003 if (bindings && try_bind (key, menu[i], buf->data, bindings) != 0)
1005 snprintf (err->data, err->dsize, _("%s: no such function in map"), buf->data);
1015 /* macro <menu> <key> <macro> <description> */
1016 int mutt_parse_macro (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
1018 int menu[sizeof(Menus)/sizeof(struct mapping_t)-1], r = -1, nummenus, i;
1022 if ((key = parse_keymap (menu, s, sizeof (menu) / sizeof (menu[0]), &nummenus, err)) == NULL)
1025 mutt_extract_token (buf, s, M_TOKEN_CONDENSE);
1026 /* make sure the macro sequence is not an empty string */
1029 strfcpy (err->data, _("macro: empty key sequence"), err->dsize);
1035 seq = safe_strdup (buf->data);
1036 mutt_extract_token (buf, s, M_TOKEN_CONDENSE);
1040 strfcpy (err->data, _("macro: too many arguments"), err->dsize);
1044 for (i = 0; i < nummenus; ++i)
1046 km_bind (key, menu[i], OP_MACRO, seq, buf->data);
1055 for (i = 0; i < nummenus; ++i)
1057 km_bind (key, menu[i], OP_MACRO, buf->data, NULL);
1066 /* exec function-name */
1067 int mutt_parse_exec (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
1071 struct binding_t *bindings = NULL;
1076 strfcpy (err->data, _("exec: no arguments"), err->dsize);
1082 mutt_extract_token (buf, s, 0);
1083 function = buf->data;
1085 if ((bindings = km_get_table (CurrentMenu)) == NULL
1086 && CurrentMenu != MENU_PAGER)
1087 bindings = OpGeneric;
1089 ops[nops] = get_op (bindings, function, mutt_strlen(function));
1090 if (ops[nops] == OP_NULL && CurrentMenu != MENU_PAGER)
1091 ops[nops] = get_op (OpGeneric, function, mutt_strlen(function));
1093 if (ops[nops] == OP_NULL)
1096 mutt_error (_("%s: no such function"), function);
1101 while(MoreArgs(s) && nops < sizeof(ops)/sizeof(ops[0]));
1104 mutt_ungetch(0, ops[--nops]);
1110 * prompts the user to enter a keystroke, and displays the octal value back
1113 void mutt_what_key (void)
1117 mvprintw(LINES-1,0, _("Enter keys (^G to abort): "));
1120 if (ch != ERR && ch != ctrl ('G'))
1122 mutt_message(_("Char = %s, Octal = %o, Decimal = %d"),
1123 km_keyname(ch), ch, ch);
1126 while (ch != ERR && ch != ctrl ('G'));