#include <signal.h>
#include <stdbool.h>
#include "mutt/mutt.h"
+#include "keymap.h"
#include "where.h"
#ifdef MAIN_C
WHERE SIG_ATOMIC_VOLATILE_T SigInt; ///< true after SIGINT is received
WHERE SIG_ATOMIC_VOLATILE_T SigWinch; ///< true after SIGWINCH is received
-WHERE int CurrentMenu; ///< Current Menu, e.g. #MENU_PAGER
+WHERE enum MenuType CurrentMenu; ///< Current Menu, e.g. #MENU_PAGER
WHERE struct AliasList Aliases INITVAL(TAILQ_HEAD_INITIALIZER(Aliases)); ///< List of all the user's email aliases
/**
* help_lookup_function - Find a keybinding for an operation
* @param op Operation, e.g. OP_DELETE
- * @param menu Current Menu
+ * @param menu Current Menu, e.g. #MENU_PAGER
* @retval ptr Key binding
* @retval NULL If none
*/
-static const struct Binding *help_lookup_function(int op, int menu)
+static const struct Binding *help_lookup_function(int op, enum MenuType menu)
{
const struct Binding *map = NULL;
* @param buf Buffer for the result
* @param buflen Length of buffer
* @param txt Text part, e.g. "delete"
- * @param menu Current Menu
+ * @param menu Current Menu, e.g. #MENU_PAGER
* @param op Operation, e.g. OP_DELETE
*
* This will return something like: "d:delete"
*/
-void mutt_make_help(char *buf, size_t buflen, const char *txt, int menu, int op)
+void mutt_make_help(char *buf, size_t buflen, const char *txt, enum MenuType menu, int op)
{
char tmp[128];
* mutt_compile_help - Create the text for the help menu
* @param buf Buffer for the result
* @param buflen Length of buffer
- * @param menu Current Menu
+ * @param menu Current Menu, e.g. #MENU_PAGER
* @param items Map of functions to display in the help bar
* @retval ptr Buffer containing result
*/
-char *mutt_compile_help(char *buf, size_t buflen, int menu, const struct Mapping *items)
+char *mutt_compile_help(char *buf, size_t buflen, enum MenuType menu,
+ const struct Mapping *items)
{
char *pbuf = buf;
/**
* dump_menu - Write all the key bindings to a file
* @param fp File to write to
- * @param menu Current Menu
+ * @param menu Current Menu, e.g. #MENU_PAGER
*/
-static void dump_menu(FILE *fp, int menu)
+static void dump_menu(FILE *fp, enum MenuType menu)
{
struct Keymap *map = NULL;
const struct Binding *b = NULL;
* mutt_help - Display the help menu
* @param menu Current Menu
*/
-void mutt_help(int menu)
+void mutt_help(enum MenuType menu)
{
char t[PATH_MAX];
char buf[128];
mutt_sleep(0);
- /* Note that menu->menu may be MENU_PAGER if the change folder
+ /* Note that menu->type may be MENU_PAGER if the change folder
* operation originated from the pager.
*
* However, exec commands currently use CurrentMenu to determine what
if (op >= 0)
mutt_curs_set(0);
- if (menu->menu == MENU_MAIN)
+ if (menu->type == MENU_MAIN)
{
index_custom_redraw(menu);
/* Similar to OP_MAIN_ENTIRE_THREAD, keep displaying the old message, but
* update the index */
- if (menu->menu == MENU_PAGER)
+ if (menu->type == MENU_PAGER)
{
menu->current = e_oldcur->vnum;
menu->redraw = REDRAW_STATUS | REDRAW_INDEX;
mutt_error(_("No deleted messages found in the thread"));
/* Similar to OP_MAIN_ENTIRE_THREAD, keep displaying the old message, but
* update the index */
- if (menu->menu == MENU_PAGER)
+ if (menu->type == MENU_PAGER)
{
op = OP_DISPLAY_MESSAGE;
continue;
menu->current = e->vnum;
}
- if (menu->menu == MENU_PAGER)
+ if (menu->type == MENU_PAGER)
{
op = OP_DISPLAY_MESSAGE;
continue;
resort_index(menu);
OptSearchInvalid = true;
}
- if (menu->menu == MENU_PAGER)
+ if (menu->type == MENU_PAGER)
{
op = OP_DISPLAY_MESSAGE;
continue;
ctx_free(&Context);
/* if we were in the pager, redisplay the message */
- if (menu->menu == MENU_PAGER)
+ if (menu->type == MENU_PAGER)
{
op = OP_DISPLAY_MESSAGE;
continue;
mutt_set_vnum(Context);
}
}
- if (menu->menu == MENU_PAGER)
+ if (menu->type == MENU_PAGER)
{
op = OP_DISPLAY_MESSAGE;
continue;
CUR_EMAIL->quasi_deleted = !still_queried;
Context->mailbox->changed = true;
}
- if (menu->menu == MENU_PAGER)
+ if (menu->type == MENU_PAGER)
{
op = OP_DISPLAY_MESSAGE;
continue;
if (mutt_buffer_enter_fname(cp, folderbuf, true) == -1)
{
- if (menu->menu == MENU_PAGER)
+ if (menu->type == MENU_PAGER)
{
op = OP_DISPLAY_MESSAGE;
cont = true;
Context->mailbox->emails[Context->mailbox->v2r[menu->current]]->index;
/* If we are returning to the pager via an index menu redirection, we
- * need to reset the menu->menu. Otherwise mutt_menu_pop_current() will
+ * need to reset the menu->type. Otherwise mutt_menu_pop_current() will
* set CurrentMenu incorrectly when we return back to the index menu. */
- menu->menu = MENU_MAIN;
+ menu->type = MENU_MAIN;
op = mutt_display_message(Context->mailbox, CUR_EMAIL);
if (op < 0)
/* This is used to redirect a single operation back here afterwards. If
* mutt_display_message() returns 0, then the menu and pager state will
* be cleaned up after this switch statement. */
- menu->menu = MENU_PAGER;
+ menu->type = MENU_PAGER;
menu->oldcurrent = menu->current;
update_index(menu, Context, MUTT_NEW_MAIL, Context->mailbox->msg_count, hint);
continue;
case OP_EXIT:
close = op;
- if ((menu->menu == MENU_MAIN) && attach_msg)
+ if ((menu->type == MENU_MAIN) && attach_msg)
{
done = true;
break;
}
- if ((menu->menu == MENU_MAIN) &&
+ if ((menu->type == MENU_MAIN) &&
(query_quadoption(C_Quit, _("Exit NeoMutt without saving?")) == MUTT_YES))
{
if (Context)
Context->mailbox->changed = true;
mutt_message(_("Thread broken"));
- if (menu->menu == MENU_PAGER)
+ if (menu->type == MENU_PAGER)
{
op = OP_DISPLAY_MESSAGE;
continue;
emaillist_clear(&el);
}
- if (menu->menu == MENU_PAGER)
+ if (menu->type == MENU_PAGER)
{
op = OP_DISPLAY_MESSAGE;
continue;
break;
mutt_edit_content_type(CUR_EMAIL, CUR_EMAIL->content, NULL);
/* if we were in the pager, redisplay the message */
- if (menu->menu == MENU_PAGER)
+ if (menu->type == MENU_PAGER)
{
op = OP_DISPLAY_MESSAGE;
continue;
break;
if (menu->current >= (Context->mailbox->vcount - 1))
{
- if (menu->menu == MENU_MAIN)
+ if (menu->type == MENU_MAIN)
mutt_message(_("You are on the last message"));
break;
}
if (menu->current == -1)
{
menu->current = menu->oldcurrent;
- if (menu->menu == MENU_MAIN)
+ if (menu->type == MENU_MAIN)
mutt_error(_("No undeleted messages"));
}
- else if (menu->menu == MENU_PAGER)
+ else if (menu->type == MENU_PAGER)
{
op = OP_DISPLAY_MESSAGE;
continue;
break;
if (menu->current >= (Context->mailbox->vcount - 1))
{
- if (menu->menu == MENU_MAIN)
+ if (menu->type == MENU_MAIN)
mutt_message(_("You are on the last message"));
break;
}
menu->current++;
- if (menu->menu == MENU_PAGER)
+ if (menu->type == MENU_PAGER)
{
op = OP_DISPLAY_MESSAGE;
continue;
if (menu->current == -1)
{
menu->current = menu->oldcurrent;
- if (menu->menu == MENU_MAIN)
+ if (menu->type == MENU_MAIN)
mutt_error(_("No undeleted messages"));
}
- else if (menu->menu == MENU_PAGER)
+ else if (menu->type == MENU_PAGER)
{
op = OP_DISPLAY_MESSAGE;
continue;
break;
if (menu->current < 1)
{
- if (menu->menu == MENU_MAIN)
+ if (menu->type == MENU_MAIN)
mutt_message(_("You are on the first message"));
break;
}
menu->current--;
- if (menu->menu == MENU_PAGER)
+ if (menu->type == MENU_PAGER)
{
op = OP_DISPLAY_MESSAGE;
continue;
mutt_message(_("Search wrapped to bottom"));
}
- if (menu->menu == MENU_PAGER)
+ if (menu->type == MENU_PAGER)
{
op = OP_DISPLAY_MESSAGE;
continue;
break;
if (mx_toggle_write(Context->mailbox) == 0)
{
- if (menu->menu == MENU_PAGER)
+ if (menu->type == MENU_PAGER)
{
op = OP_DISPLAY_MESSAGE;
continue;
else
mutt_error(_("You are on the first thread"));
}
- else if (menu->menu == MENU_PAGER)
+ else if (menu->type == MENU_PAGER)
{
op = OP_DISPLAY_MESSAGE;
continue;
{
menu->current = menu->oldcurrent;
}
- else if (menu->menu == MENU_PAGER)
+ else if (menu->type == MENU_PAGER)
{
op = OP_DISPLAY_MESSAGE;
continue;
menu->current = menu->oldcurrent;
menu->redraw |= REDRAW_CURRENT;
}
- else if (menu->menu == MENU_PAGER)
+ else if (menu->type == MENU_PAGER)
{
op = OP_DISPLAY_MESSAGE;
continue;
emaillist_clear(&el);
}
- if (menu->menu == MENU_PAGER)
+ if (menu->type == MENU_PAGER)
{
op = OP_DISPLAY_MESSAGE;
continue;
{
menu->current = menu->oldcurrent;
}
- else if (menu->menu == MENU_PAGER)
+ else if (menu->type == MENU_PAGER)
{
op = OP_DISPLAY_MESSAGE;
continue;
#endif
default:
- if (menu->menu == MENU_MAIN)
+ if (menu->type == MENU_MAIN)
km_error_key(MENU_MAIN);
}
nm_db_debug_check(Context->mailbox);
#endif
- if (menu->menu == MENU_PAGER)
+ if (menu->type == MENU_PAGER)
{
mutt_clear_pager_position();
- menu->menu = MENU_MAIN;
+ menu->type = MENU_MAIN;
menu->redraw = REDRAW_FULL;
}
*/
static bool is_function(const char *name)
{
- for (int i = 0; i < MENU_MAX; i++)
+ for (enum MenuType i = 0; i < MENU_MAX; i++)
{
const struct Binding *b = km_get_table(Menus[i].value);
if (!b)
* Insert a key sequence into the specified map.
* The map is sorted by ASCII value (lowest to highest)
*/
-static enum CommandResult km_bind_err(const char *s, int menu, int op,
+static enum CommandResult km_bind_err(const char *s, enum MenuType menu, int op,
char *macro, char *desc, struct Buffer *err)
{
enum CommandResult rc = MUTT_CMD_SUCCESS;
* @param desc Description of macro (OPTIONAL)
* @retval #CommandResult Result e.g. #MUTT_CMD_SUCCESS
*/
-enum CommandResult km_bind(char *s, int menu, int op, char *macro, char *desc)
+enum CommandResult km_bind(char *s, enum MenuType menu, int op, char *macro, char *desc)
{
return km_bind_err(s, menu, op, macro, desc, NULL);
}
* @param err Buffer for error message
* @retval #CommandResult Result e.g. #MUTT_CMD_SUCCESS
*/
-static enum CommandResult km_bindkey_err(const char *s, int menu, int op, struct Buffer *err)
+static enum CommandResult km_bindkey_err(const char *s, enum MenuType menu,
+ int op, struct Buffer *err)
{
return km_bind_err(s, menu, op, NULL, NULL, err);
}
* @param op Operation, e.g. OP_DELETE
* @retval #CommandResult Result e.g. #MUTT_CMD_SUCCESS
*/
-static enum CommandResult km_bindkey(const char *s, int menu, int op)
+static enum CommandResult km_bindkey(const char *s, enum MenuType menu, int op)
{
return km_bindkey_err(s, menu, op, NULL);
}
/* See if it is a valid command
* skip the '<' and the '>' when comparing */
- for (i = 0; Menus[i].name; i++)
+ for (enum MenuType j = 0; Menus[j].name; j++)
{
- const struct Binding *binding = km_get_table(Menus[i].value);
+ const struct Binding *binding = km_get_table(Menus[j].value);
if (binding)
{
op = get_op(binding, pp + 1, l - 2);
* @param lastkey Last key pressed (to return to input queue)
* @retval num Operation, e.g. OP_DELETE
*/
-static int retry_generic(int menu, keycode_t *keys, int keyslen, int lastkey)
+static int retry_generic(enum MenuType menu, keycode_t *keys, int keyslen, int lastkey)
{
if ((menu != MENU_EDITOR) && (menu != MENU_GENERIC) && (menu != MENU_PAGER))
{
* @retval -1 Error occurred while reading input
* @retval -2 A timeout or sigwinch occurred
*/
-int km_dokey(int menu)
+int km_dokey(enum MenuType menu)
{
struct KeyEvent tmp;
struct Keymap *map = Keymaps[menu];
* @param map Key bindings
* @param menu Menu id, e.g. #MENU_PAGER
*/
-static void create_bindings(const struct Binding *map, int menu)
+static void create_bindings(const struct Binding *map, enum MenuType menu)
{
for (int i = 0; map[i].name; i++)
if (map[i].seq)
* @param func Function, e.g. OP_DELETE
* @retval ptr Keymap for the function
*/
-struct Keymap *km_find_func(int menu, int func)
+struct Keymap *km_find_func(enum MenuType menu, int func)
{
struct Keymap *map = Keymaps[menu];
* km_error_key - Handle an unbound key sequence
* @param menu Menu id, e.g. #MENU_PAGER
*/
-void km_error_key(int menu)
+void km_error_key(enum MenuType menu)
{
char buf[128];
int p, op;
/**
* parse_keymap - Parse a user-config key binding
- * @param menu Array for results
- * @param s Buffer containing config string
- * @param maxmenus Total number of menus
- * @param nummenus Number of menus this config applies to
- * @param err Buffer for error messages
- * @param bind If true 'bind', otherwise 'macro'
+ * @param menu Array for results
+ * @param s Buffer containing config string
+ * @param max_menus Total number of menus
+ * @param num_menus Number of menus this config applies to
+ * @param err Buffer for error messages
+ * @param bind If true 'bind', otherwise 'macro'
* @retval ptr Key string for the binding
*
* Expects to see: <menu-string>,<menu-string>,... <key-string>
*
* @note Caller needs to free the returned string
*/
-static char *parse_keymap(int *menu, struct Buffer *s, int maxmenus,
- int *nummenus, struct Buffer *err, bool bind)
+static char *parse_keymap(enum MenuType *menu, struct Buffer *s, int max_menus,
+ int *num_menus, struct Buffer *err, bool bind)
{
struct Buffer buf;
int i = 0;
char *p = buf.data;
if (MoreArgs(s))
{
- while (i < maxmenus)
+ while (i < max_menus)
{
q = strchr(p, ',');
if (q)
else
break;
}
- *nummenus = i;
+ *num_menus = i;
/* key sequence */
mutt_extract_token(&buf, s, MUTT_TOKEN_NO_FLAGS);
* @param err Buffer for error message
* @retval #CommandResult Result e.g. #MUTT_CMD_SUCCESS
*/
-static enum CommandResult try_bind(char *key, int menu, char *func,
+static enum CommandResult try_bind(char *key, enum MenuType menu, char *func,
const struct Binding *bindings, struct Buffer *err)
{
for (int i = 0; bindings[i].name; i++)
* @param menu Menu id, e.g. #MENU_EDITOR
* @retval ptr Array of keybindings
*/
-const struct Binding *km_get_table(int menu)
+const struct Binding *km_get_table(enum MenuType menu)
{
switch (menu)
{
return OpPost;
case MENU_QUERY:
return OpQuery;
+ default:
+ return NULL;
}
- return NULL;
}
/**
unsigned long data, struct Buffer *err)
{
const struct Binding *bindings = NULL;
- int menu[sizeof(Menus) / sizeof(struct Mapping) - 1], nummenus;
+ enum MenuType menu[sizeof(Menus) / sizeof(struct Mapping) - 1];
+ int num_menus = 0;
enum CommandResult rc = MUTT_CMD_SUCCESS;
- char *key = parse_keymap(menu, s, mutt_array_size(menu), &nummenus, err, true);
+ char *key = parse_keymap(menu, s, mutt_array_size(menu), &num_menus, err, true);
if (!key)
return MUTT_CMD_ERROR;
}
else if (mutt_str_strcasecmp("noop", buf->data) == 0)
{
- for (int i = 0; i < nummenus; i++)
+ for (int i = 0; i < num_menus; i++)
{
km_bindkey(key, menu[i], OP_NULL); /* the 'unbind' command */
}
}
else
{
- for (int i = 0; i < nummenus; i++)
+ for (int i = 0; i < num_menus; i++)
{
/* The pager and editor menus don't use the generic map,
* however for other menus try generic first. */
*
* Expects to see: <menu-string>[,<menu-string>]
*/
-static void *parse_menu(int *menu, char *s, struct Buffer *err)
+static void *parse_menu(bool *menu, char *s, struct Buffer *err)
{
char *menu_names_dup = mutt_str_strdup(s);
char *marker = menu_names_dup;
enum CommandResult mutt_parse_unbind(struct Buffer *buf, struct Buffer *s,
unsigned long data, struct Buffer *err)
{
- int menu[MENU_MAX] = { 0 };
+ bool menu[MENU_MAX] = { 0 };
bool all_keys = false;
char *key = NULL;
mutt_extract_token(buf, s, MUTT_TOKEN_NO_FLAGS);
if (mutt_str_strcmp(buf->data, "*") == 0)
{
- for (int i = 0; i < MENU_MAX; i++)
- menu[i] = 1;
+ for (enum MenuType i = 0; i < MENU_MAX; i++)
+ menu[i] = true;
}
else
parse_menu(menu, buf->data, err);
return MUTT_CMD_ERROR;
}
- for (int i = 0; i < MENU_MAX; i++)
+ for (enum MenuType i = 0; i < MENU_MAX; i++)
{
- if (menu[i] != 1)
+ if (!menu[i])
continue;
if (all_keys)
{
enum CommandResult mutt_parse_macro(struct Buffer *buf, struct Buffer *s,
unsigned long data, struct Buffer *err)
{
- int menu[sizeof(Menus) / sizeof(struct Mapping) - 1], nummenus;
+ enum MenuType menu[sizeof(Menus) / sizeof(struct Mapping) - 1];
+ int num_menus = 0;
enum CommandResult rc = MUTT_CMD_ERROR;
char *seq = NULL;
- char *key = parse_keymap(menu, s, mutt_array_size(menu), &nummenus, err, false);
+ char *key = parse_keymap(menu, s, mutt_array_size(menu), &num_menus, err, false);
if (!key)
return MUTT_CMD_ERROR;
}
else
{
- for (int i = 0; i < nummenus; i++)
+ for (int i = 0; i < num_menus; i++)
{
rc = km_bind(key, menu[i], OP_MACRO, seq, buf->data);
}
}
else
{
- for (int i = 0; i < nummenus; i++)
+ for (int i = 0; i < num_menus; i++)
{
rc = km_bind(key, menu[i], OP_MACRO, buf->data, NULL);
}
/* type for key storage, the rest of neomutt works fine with int type */
typedef short keycode_t;
-enum CommandResult km_bind(char *s, int menu, int op, char *macro, char *desc);
-int km_dokey(int menu);
-
void init_extended_keys(void);
/**
keycode_t *keys; /**< key sequence */
};
-int km_expand_key(char *s, size_t len, struct Keymap *map);
-struct Keymap *km_find_func(int menu, int func);
-void km_init(void);
-void km_error_key(int menu);
-void mutt_what_key(void);
-
/**
* enum MenuType - Types of GUI selections
*/
MENU_MAX,
};
+int km_expand_key(char *s, size_t len, struct Keymap *map);
+struct Keymap *km_find_func(enum MenuType menu, int func);
+void km_init(void);
+void km_error_key(enum MenuType menu);
+void mutt_what_key(void);
+
+enum CommandResult km_bind(char *s, enum MenuType menu, int op, char *macro, char *desc);
+int km_dokey(enum MenuType menu);
+
extern struct Keymap *Keymaps[]; ///< Array of Keymap keybindings, one for each Menu
extern int LastKey; ///< Last real key pressed, recorded by dokey()
const char *seq; /**< default key binding */
};
-const struct Binding *km_get_table(int menu);
+const struct Binding *km_get_table(enum MenuType menu);
const char *mutt_get_func(const struct Binding *bindings, int op);
extern const struct Binding OpGeneric[];
if (type >= MENU_MAX)
type = MENU_GENERIC;
- menu->menu = type;
+ menu->type = type;
menu->current = 0;
menu->top = 0;
menu->offset = 0;
}
MenuStack[MenuStackCount++] = menu;
- CurrentMenu = menu->menu;
+ CurrentMenu = menu->type;
}
/**
prev_menu = get_current_menu();
if (prev_menu)
{
- CurrentMenu = prev_menu->menu;
+ CurrentMenu = prev_menu->type;
prev_menu->redraw = REDRAW_FULL;
}
else
/**
* mutt_menu_set_redraw - Set redraw flags on a menu
- * @param menu_type Menu type, e.g. #MENU_ALIAS
- * @param redraw Flags, e.g. #REDRAW_INDEX
+ * @param menu Menu type, e.g. #MENU_ALIAS
+ * @param redraw Flags, e.g. #REDRAW_INDEX
*
* This is ignored if it's not the current menu.
*/
-void mutt_menu_set_redraw(int menu_type, MuttRedrawFlags redraw)
+void mutt_menu_set_redraw(enum MenuType menu, MuttRedrawFlags redraw)
{
- if (CurrentMenu == menu_type)
+ if (CurrentMenu == menu)
mutt_menu_set_current_redraw(redraw);
}
/**
* mutt_menu_set_redraw_full - Flag a menu to be fully redrawn
- * @param menu_type Menu type, e.g. #MENU_ALIAS
+ * @param menu Menu type, e.g. #MENU_ALIAS
*
* This is ignored if it's not the current menu.
*/
-void mutt_menu_set_redraw_full(int menu_type)
+void mutt_menu_set_redraw_full(enum MenuType menu)
{
- if (CurrentMenu == menu_type)
+ if (CurrentMenu == menu)
mutt_menu_set_current_redraw_full();
}
regex_t re;
char buf[128];
char *search_buf =
- ((menu->menu >= 0) && (menu->menu < MENU_MAX)) ? SearchBuffers[menu->menu] : NULL;
+ ((menu->type >= 0) && (menu->type < MENU_MAX)) ? SearchBuffers[menu->type] : NULL;
if (!(search_buf && *search_buf) || ((op != OP_SEARCH_NEXT) && (op != OP_SEARCH_OPPOSITE)))
{
{
return -1;
}
- if ((menu->menu >= 0) && (menu->menu < MENU_MAX))
+ if ((menu->type >= 0) && (menu->type < MENU_MAX))
{
- mutt_str_replace(&SearchBuffers[menu->menu], buf);
- search_buf = SearchBuffers[menu->menu];
+ mutt_str_replace(&SearchBuffers[menu->type], buf);
+ search_buf = SearchBuffers[menu->type];
}
menu->search_dir =
((op == OP_SEARCH) || (op == OP_SEARCH_NEXT)) ? MUTT_SEARCH_DOWN : MUTT_SEARCH_UP;
if (menu->dialog && (menu_dialog_dokey(menu, &i) == 0))
return i;
- i = km_dokey(menu->menu);
+ i = km_dokey(menu->type);
if ((i == OP_TAG_PREFIX) || (i == OP_TAG_PREFIX_COND))
{
if (menu->tagprefix)
break;
case OP_HELP:
- mutt_help(menu->menu);
+ mutt_help(menu->type);
menu->redraw = REDRAW_FULL;
break;
case OP_NULL:
- km_error_key(menu->menu);
+ km_error_key(menu->type);
break;
case OP_END_COND:
#include "config/lib.h"
#include "email/lib.h"
#include "hook.h"
+#include "keymap.h"
#include "mutt_commands.h"
struct Buffer;
#define EXEC_SHELL "/bin/sh"
-char *mutt_compile_help(char *buf, size_t buflen, int menu, const struct Mapping *items);
+char *mutt_compile_help(char *buf, size_t buflen, enum MenuType menu, const struct Mapping *items);
int mutt_extract_token(struct Buffer *dest, struct Buffer *tok, TokenFlags flags);
void mutt_free_opts(void);
*/
struct Menu
{
- char *title; /**< the title of this menu */
- char *help; /**< quickref for the current menu */
- void *data; /**< extra data for the current menu */
- int current; /**< current entry */
- int max; /**< the number of entries in the menu */
- MuttRedrawFlags redraw; /**< when to redraw the screen */
- int menu; /**< menu definition for keymap entries. */
- int offset; /**< row offset within the window to start the index */
- int pagelen; /**< number of entries per screen */
+ char *title; ///< Title of this menu
+ char *help; ///< Quickref for the current menu
+ void *data; ///< Extra data for the current menu
+ int current; ///< Current entry
+ int max; ///< Number of entries in the menu
+ MuttRedrawFlags redraw; ///< When to redraw the screen
+ enum MenuType type; ///< Menu definition for keymap entries
+ int offset; ///< Row offset within the window to start the index
+ int pagelen; ///< Number of entries per screen
bool tagprefix : 1;
bool is_mailbox_list : 1;
struct MuttWindow *indexwin;
* In dialog mode menubar is hidden and prompt keys are checked before
* normal menu movement keys. This can cause problems with scrolling, if
* prompt keys override movement keys. */
- char **dialog; /**< dialog lines themselves */
- int dsize; /**< number of allocated dialog lines */
- char *prompt; /**< prompt for user, similar to mutt_multi_choice */
- char *keys; /**< keys used in the prompt */
+ char **dialog; ///< Dialog lines themselves
+ int dsize; ///< Number of allocated dialog lines
+ char *prompt; ///< Prompt for user, similar to mutt_multi_choice
+ char *keys; ///< Keys used in the prompt
/* the following are used only by mutt_menu_loop() */
- int top; /**< entry that is the top of the current page */
- int oldcurrent; /**< for driver use only */
- int search_dir; /**< direction of search */
- int tagged; /**< number of tagged entries */
+ int top; ///< Entry that is the top of the current page
+ int oldcurrent; ///< For driver use only
+ int search_dir; ///< Direction of search
+ int tagged; ///< Number of tagged entries
/**
* menu_make_entry - Format a item for a menu
* @param[in] menu Menu containing items
* @param[in] line Menu line number
*/
- void (*menu_make_entry) (char *buf, size_t buflen, struct Menu *menu, int line);
+ void (*menu_make_entry)(char *buf, size_t buflen, struct Menu *menu, int line);
/**
* menu_search - Search a menu for a item matching a regex
* @param menu Menu to search
* @retval 0 Success
* @retval >0 Error, e.g. REG_NOMATCH
*/
- int (*menu_search) (struct Menu *menu, regex_t *rx, int line);
+ int (*menu_search)(struct Menu *menu, regex_t *rx, int line);
/**
* menu_tag - Tag some menu items
* @param menu Menu to tag
* @param act Action: 0 untag, 1 tag, -1 toggle
* @retval num Net change in number of tagged attachments
*/
- int (*menu_tag) (struct Menu *menu, int sel, int act);
+ int (*menu_tag)(struct Menu *menu, int sel, int act);
/**
* menu_color - Calculate the colour for a line of the menu
* @param line Menu line number
* @retval >0 Colour pair in an integer
* @retval 0 No colour
*/
- int (*menu_color) (int line);
+ int (*menu_color)(int line);
/**
* menu_custom_redraw - Redraw the menu
* @param menu Menu to redraw
void mutt_menu_push_current(struct Menu *menu);
void mutt_menu_set_current_redraw_full(void);
void mutt_menu_set_current_redraw(MuttRedrawFlags redraw);
-void mutt_menu_set_redraw_full(int menu_type);
-void mutt_menu_set_redraw(int menu_type, MuttRedrawFlags redraw);
+void mutt_menu_set_redraw_full(enum MenuType menu);
+void mutt_menu_set_redraw(enum MenuType menu, MuttRedrawFlags redraw);
int mutt_menu_observer(struct NotifyCallback *nc);
#include <stdbool.h>
#include <stdio.h>
#include "mutt.h"
+#include "keymap.h"
#include "ncrypt/ncrypt.h"
struct Context;
int mutt_system(const char *cmd);
int mutt_set_xdg_path(enum XdgType type, char *buf, size_t bufsize);
-void mutt_help(int menu);
-void mutt_make_help(char *d, size_t dlen, const char *txt, int menu, int op);
+void mutt_help(enum MenuType menu);
+void mutt_make_help(char *d, size_t dlen, const char *txt, enum MenuType menu, int op);
void mutt_set_flag_update(struct Mailbox *m, struct Email *e, int flag, bool bf, bool upd_mbox);
#define mutt_set_flag(m, e, flag, bf) mutt_set_flag_update(m, e, flag, bf, true)
void mutt_signal_init(void);