NeoMutt  2025-09-05-43-g177ed6
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
lib.c File Reference

Key helper functions. More...

#include "config.h"
#include <ctype.h>
#include <limits.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#include "mutt/lib.h"
#include "gui/lib.h"
#include "lib.h"
#include "menu/lib.h"
+ Include dependency graph for lib.c:

Go to the source code of this file.

Functions

void mutt_keymap_free (struct Keymap **ptr)
 Free a Keymap.
 
struct Keymapalloc_keys (size_t len, keycode_t *keys)
 Allocate space for a sequence of keys.
 
int parse_fkey (char *s)
 Parse a function key string.
 
static int parse_keycode (const char *s)
 Parse a numeric keycode.
 
size_t parsekeys (const char *str, keycode_t *d, size_t max)
 Parse a key string into key codes.
 
struct Keymapkm_compare_keys (struct Keymap *k1, struct Keymap *k2, size_t *pos)
 Compare two keymaps' keyscodes and return the bigger one.
 
int get_op (const struct MenuFuncOp *funcs, const char *start, size_t len)
 Get the function by its name.
 
const char * mutt_get_func (const struct MenuFuncOp *funcs, int op)
 Get the name of a function.
 
void escape_macro (const char *macro, struct Buffer *buf)
 Escape any special characters in a macro.
 
bool is_bound (const struct KeymapList *km_list, int op)
 Does a function have a keybinding?
 
int binding_sort (const void *a, const void *b, void *sdata)
 Compare two BindingInfo by their keybinding - Implements sort_t -.
 
int measure_column (struct BindingInfoArray *bia, int col)
 Measure one column of a table.
 
int gather_unbound (const struct MenuFuncOp *funcs, const struct KeymapList *km_menu, const struct KeymapList *km_aux, struct BindingInfoArray *bia_unbound)
 Gather info about unbound functions for one menu.
 
void km_keyname (int c, struct Buffer *buf)
 Get the human name for a key.
 
bool km_expand_key (struct Keymap *map, struct Buffer *buf)
 Get the key string bound to a Keymap.
 
void km_expand_key_string (char *str, struct Buffer *buf)
 Get a human-readable key string.
 
struct Keymapkm_find_func (enum MenuType mtype, int func)
 Find a function's mapping in a Menu.
 
const struct MenuFuncOpkm_get_table (enum MenuType mtype)
 Lookup a Menu's functions.
 
static const char * help_lookup_function (int op, enum MenuType menu)
 Find a keybinding for an operation.
 
void gather_menu (enum MenuType menu, struct BindingInfoArray *bia_bind, struct BindingInfoArray *bia_macro)
 Gather info about one menu.
 

Variables

const struct MenuFuncOp OpAlias []
 Functions for the Alias Menu.
 
const struct MenuFuncOp OpAttachment []
 Functions for the Attachment Menu.
 
const struct MenuFuncOp OpAutocrypt []
 Functions for the Autocrypt Account.
 
const struct MenuFuncOp OpBrowser []
 Functions for the file Browser Menu.
 
const struct MenuFuncOp OpCompose []
 Functions for the Compose Menu.
 
const struct MenuFuncOp OpEditor []
 Functions for the Editor Menu.
 
const struct MenuFuncOp OpIndex []
 Functions for the Index Menu.
 
const struct MenuFuncOp OpPager []
 Functions for the Pager Menu.
 
const struct MenuFuncOp OpPgp []
 Functions for the Pgp Menu.
 
const struct MenuFuncOp OpPostponed []
 Functions for the Postpone Menu.
 
const struct MenuFuncOp OpQuery []
 Functions for the external Query Menu.
 
const struct MenuFuncOp OpSmime []
 Functions for the Smime Menu.
 
struct Mapping KeyNames []
 Key name lookup table.
 
keycode_t AbortKey
 code of key to abort prompts, normally Ctrl-G
 
struct KeymapList Keymaps [MENU_MAX]
 Array of key mappings, one for each MenuType.
 

Detailed Description

Key helper functions.

Authors
  • Richard Russon

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file lib.c.

Function Documentation

◆ mutt_keymap_free()

void mutt_keymap_free ( struct Keymap ** ptr)

Free a Keymap.

Parameters
ptrKeymap to free

Definition at line 130 of file lib.c.

131{
132 if (!ptr || !*ptr)
133 return;
134
135 struct Keymap *km = *ptr;
136 FREE(&km->macro);
137 FREE(&km->desc);
138 FREE(&km->keys);
139
140 FREE(ptr);
141}
#define FREE(x)
Definition memory.h:62
A keyboard mapping.
Definition lib.h:67
keycode_t * keys
key sequence
Definition lib.h:73
char * macro
Macro expansion (op == OP_MACRO)
Definition lib.h:68
char * desc
Description of a macro for the help menu.
Definition lib.h:69
+ Here is the caller graph for this function:

◆ alloc_keys()

struct Keymap * alloc_keys ( size_t len,
keycode_t * keys )

Allocate space for a sequence of keys.

Parameters
lenNumber of keys
keysArray of keys
Return values
ptrSequence of keys

Definition at line 149 of file lib.c.

150{
151 struct Keymap *p = MUTT_MEM_CALLOC(1, struct Keymap);
152 p->len = len;
154 memcpy(p->keys, keys, len * sizeof(keycode_t));
155 return p;
156}
short keycode_t
Type for key storage, the rest of neomutt works fine with int type.
Definition lib.h:57
#define MUTT_MEM_CALLOC(n, type)
Definition memory.h:47
short len
Length of key sequence (unit: sizeof (keycode_t))
Definition lib.h:72
+ Here is the caller graph for this function:

◆ parse_fkey()

int parse_fkey ( char * s)

Parse a function key string.

Parameters
sString to parse
Return values
numNumber of the key

Given "<f8>", it will return 8.

Definition at line 165 of file lib.c.

166{
167 char *t = NULL;
168 int n = 0;
169
170 if ((s[0] != '<') || (mutt_tolower(s[1]) != 'f'))
171 return -1;
172
173 for (t = s + 2; *t && mutt_isdigit(*t); t++)
174 {
175 n *= 10;
176 n += *t - '0';
177 }
178
179 if (*t != '>')
180 return -1;
181 return n;
182}
int mutt_tolower(int arg)
Wrapper for tolower(3)
Definition ctype.c:125
bool mutt_isdigit(int arg)
Wrapper for isdigit(3)
Definition ctype.c:65
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_keycode()

static int parse_keycode ( const char * s)
static

Parse a numeric keycode.

Parameters
sString to parse
Return values
numNumber of the key

This function parses the string <NNN> and uses the octal value as the key to bind.

Definition at line 192 of file lib.c.

193{
194 char *end_char = NULL;
195 long int result = strtol(s + 1, &end_char, 8);
196 /* allow trailing whitespace, eg. < 1001 > */
197 while (mutt_isspace(*end_char))
198 end_char++;
199 /* negative keycodes don't make sense, also detect overflow */
200 if ((*end_char != '>') || (result < 0) || (result == LONG_MAX))
201 {
202 return -1;
203 }
204
205 return result;
206}
bool mutt_isspace(int arg)
Wrapper for isspace(3)
Definition ctype.c:95
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parsekeys()

size_t parsekeys ( const char * str,
keycode_t * d,
size_t max )

Parse a key string into key codes.

Parameters
strKey string
dArray for key codes
maxMaximum length of key sequence
Return values
numLength of key sequence

Definition at line 215 of file lib.c.

216{
217 int n;
218 size_t len = max;
219 char buf[128] = { 0 };
220 char c;
221 char *t = NULL;
222
223 mutt_str_copy(buf, str, sizeof(buf));
224 char *s = buf;
225
226 while (*s && len)
227 {
228 *d = '\0';
229 if ((*s == '<') && (t = strchr(s, '>')))
230 {
231 t++;
232 c = *t;
233 *t = '\0';
234
236 if (n != -1)
237 {
238 s = t;
239 *d = n;
240 }
241 else if ((n = parse_fkey(s)) > 0)
242 {
243 s = t;
244 *d = KEY_F(n);
245 }
246 else if ((n = parse_keycode(s)) > 0)
247 {
248 s = t;
249 *d = n;
250 }
251
252 *t = c;
253 }
254
255 if (!*d)
256 {
257 *d = (unsigned char) *s;
258 s++;
259 }
260 d++;
261 len--;
262 }
263
264 return max - len;
265}
int parse_fkey(char *s)
Parse a function key string.
Definition lib.c:165
static int parse_keycode(const char *s)
Parse a numeric keycode.
Definition lib.c:192
struct Mapping KeyNames[]
Key name lookup table.
Definition lib.c:59
int mutt_map_get_value(const char *name, const struct Mapping *map)
Lookup the constant for a string.
Definition mapping.c:85
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
Definition string.c:581
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ km_compare_keys()

struct Keymap * km_compare_keys ( struct Keymap * k1,
struct Keymap * k2,
size_t * pos )

Compare two keymaps' keyscodes and return the bigger one.

Parameters
k1first keymap to compare
k2second keymap to compare
posposition where the two keycodes differ
Return values
ptrKeymap with a bigger ASCII keycode

Definition at line 274 of file lib.c.

275{
276 *pos = 0;
277
278 while (*pos < k1->len && *pos < k2->len)
279 {
280 if (k1->keys[*pos] < k2->keys[*pos])
281 return k2;
282 else if (k1->keys[*pos] > k2->keys[*pos])
283 return k1;
284 else
285 *pos = *pos + 1;
286 }
287
288 return NULL;
289}
+ Here is the caller graph for this function:

◆ get_op()

int get_op ( const struct MenuFuncOp * funcs,
const char * start,
size_t len )

Get the function by its name.

Parameters
funcsFunctions table
startName of function to find
lenLength of string to match
Return values
numOperation, e.g. OP_DELETE

Definition at line 298 of file lib.c.

299{
300 for (int i = 0; funcs[i].name; i++)
301 {
302 if (mutt_istrn_equal(start, funcs[i].name, len) && (mutt_str_len(funcs[i].name) == len))
303 {
304 return funcs[i].op;
305 }
306 }
307
308 return OP_NULL;
309}
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
Definition string.c:498
bool mutt_istrn_equal(const char *a, const char *b, size_t num)
Check for equality of two strings ignoring case (to a maximum), safely.
Definition string.c:455
const char * name
Name of the function.
Definition lib.h:116
int op
Operation, e.g. OP_DELETE.
Definition lib.h:117
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_get_func()

const char * mutt_get_func ( const struct MenuFuncOp * funcs,
int op )

Get the name of a function.

Parameters
funcsFunctions table
opOperation, e.g. OP_DELETE
Return values
ptrName of function
NULLOperation not found
Note
This returns a static string.

Definition at line 320 of file lib.c.

321{
322 if (!funcs)
323 return NULL;
324
325 for (int i = 0; funcs[i].name; i++)
326 {
327 if (funcs[i].op == op)
328 return funcs[i].name;
329 }
330
331 return NULL;
332}
+ Here is the caller graph for this function:

◆ escape_macro()

void escape_macro ( const char * macro,
struct Buffer * buf )

Escape any special characters in a macro.

Parameters
[in]macroMacro string
[out]bufBuffer for the result

Replace characters, such as <Enter> with the literal "\n"

Definition at line 341 of file lib.c.

342{
343 wchar_t wc = 0;
344 size_t k;
345 size_t len = mutt_str_len(macro);
346 mbstate_t mbstate1 = { 0 };
347 mbstate_t mbstate2 = { 0 };
348
349 for (; (len > 0) && (k = mbrtowc(&wc, macro, MB_LEN_MAX, &mbstate1)); macro += k, len -= k)
350 {
351 if ((k == ICONV_ILLEGAL_SEQ) || (k == ICONV_BUF_TOO_SMALL))
352 {
353 if (k == ICONV_ILLEGAL_SEQ)
354 memset(&mbstate1, 0, sizeof(mbstate1));
355 k = (k == ICONV_ILLEGAL_SEQ) ? 1 : len;
356 wc = ReplacementChar;
357 }
358
359 const int w = wcwidth(wc);
360 if (IsWPrint(wc) && (w >= 0))
361 {
362 char tmp[MB_LEN_MAX * 2] = { 0 };
363 if (wcrtomb(tmp, wc, &mbstate2) != ICONV_ILLEGAL_SEQ)
364 {
365 buf_addstr(buf, tmp);
366 }
367 }
368 else if ((wc < 0x20) || (wc == 0x7f))
369 {
370 if (wc == '\033') // Escape
371 buf_addstr(buf, "\\e");
372 else if (wc == '\n')
373 buf_addstr(buf, "\\n");
374 else if (wc == '\r')
375 buf_addstr(buf, "\\r");
376 else if (wc == '\t')
377 buf_addstr(buf, "\\t");
378 else
379 buf_add_printf(buf, "^%c", (char) ((wc + '@') & 0x7f));
380 }
381 else
382 {
383 buf_addch(buf, '?');
384 }
385 }
386}
int buf_add_printf(struct Buffer *buf, const char *fmt,...)
Format a string appending a Buffer.
Definition buffer.c:204
size_t buf_addch(struct Buffer *buf, char c)
Add a single character to a Buffer.
Definition buffer.c:241
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
Definition buffer.c:226
#define IsWPrint(wc)
Definition mbyte.h:41
wchar_t ReplacementChar
When a Unicode character can't be displayed, use this instead.
Definition charset.c:61
#define ICONV_BUF_TOO_SMALL
Error value for iconv() - Buffer too small.
Definition charset.h:98
#define ICONV_ILLEGAL_SEQ
Error value for iconv() - Illegal sequence.
Definition charset.h:96
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_bound()

bool is_bound ( const struct KeymapList * km_list,
int op )

Does a function have a keybinding?

Parameters
km_listKeymap to examine
opOperation, e.g. OP_DELETE
Return values
trueA key is bound to that operation

Definition at line 394 of file lib.c.

395{
396 if (!km_list)
397 return false;
398
399 struct Keymap *map = NULL;
400 STAILQ_FOREACH(map, km_list, entries)
401 {
402 if (map->op == op)
403 return true;
404 }
405 return false;
406}
#define STAILQ_FOREACH(var, head, field)
Definition queue.h:390
short op
Operation to perform.
Definition lib.h:70
+ Here is the caller graph for this function:

◆ measure_column()

int measure_column ( struct BindingInfoArray * bia,
int col )

Measure one column of a table.

Parameters
biaArray of binding info
colColumn to measure
Return values
numWidth of widest column

Definition at line 430 of file lib.c.

431{
432 int max_width = 0;
433
434 struct BindingInfo *bi = NULL;
435 ARRAY_FOREACH(bi, bia)
436 {
437 const int col_width = mutt_strwidth(bi->a[col]);
438 max_width = MAX(max_width, col_width);
439 }
440
441 return max_width;
442}
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition array.h:214
size_t mutt_strwidth(const char *s)
Measure a string's width in screen cells.
Definition curs_lib.c:445
#define MAX(a, b)
Definition memory.h:36
Info about one keybinding.
Definition lib.h:95
const char * a[3]
Array of info.
Definition lib.h:96
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gather_unbound()

int gather_unbound ( const struct MenuFuncOp * funcs,
const struct KeymapList * km_menu,
const struct KeymapList * km_aux,
struct BindingInfoArray * bia_unbound )

Gather info about unbound functions for one menu.

Parameters
funcsList of functions
km_menuKeymaps for the menu
km_auxKeymaps for generic
bia_unboundUnbound functions
Return values
numNumber of unbound functions

Definition at line 452 of file lib.c.

454{
455 if (!funcs)
456 return 0;
457
458 for (int i = 0; funcs[i].name; i++)
459 {
460 if (!funcs[i].deprecated && !is_bound(km_menu, funcs[i].op) &&
461 (!km_aux || !is_bound(km_aux, funcs[i].op)))
462 {
463 struct BindingInfo bi = { 0 };
464 bi.a[0] = NULL;
465 bi.a[1] = funcs[i].name;
466 bi.a[2] = _(opcodes_get_description(funcs[i].op));
467 ARRAY_ADD(bia_unbound, bi);
468 }
469 }
470
471 return ARRAY_SIZE(bia_unbound);
472}
#define ARRAY_ADD(head, elem)
Add an element at the end of the array.
Definition array.h:156
#define ARRAY_SIZE(head)
The number of elements stored.
Definition array.h:87
bool is_bound(const struct KeymapList *km_list, int op)
Does a function have a keybinding?
Definition lib.c:394
#define _(a)
Definition message.h:28
const char * opcodes_get_description(int op)
Get the description of an opcode.
Definition opcodes.c:68
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ km_keyname()

void km_keyname ( int c,
struct Buffer * buf )

Get the human name for a key.

Parameters
[in]cKey code
[out]bufBuffer for the result

Definition at line 479 of file lib.c.

480{
481 const char *name = mutt_map_get_name(c, KeyNames);
482 if (name)
483 {
484 buf_addstr(buf, name);
485 return;
486 }
487
488 if ((c < 256) && (c > -128) && iscntrl((unsigned char) c))
489 {
490 if (c < 0)
491 c += 256;
492
493 if (c < 128)
494 {
495 buf_addch(buf, '^');
496 buf_addch(buf, (c + '@') & 0x7f);
497 }
498 else
499 {
500 buf_add_printf(buf, "\\%d%d%d", c >> 6, (c >> 3) & 7, c & 7);
501 }
502 }
503 else if ((c >= KEY_F0) && (c < KEY_F(256))) /* this maximum is just a guess */
504 {
505 buf_add_printf(buf, "<F%d>", c - KEY_F0);
506 }
507 else if ((c < 256) && (c >= -128) && IsPrint(c))
508 {
509 buf_add_printf(buf, "%c", (unsigned char) c);
510 }
511 else
512 {
513 buf_add_printf(buf, "<%ho>", (unsigned short) c);
514 }
515}
const char * mutt_map_get_name(int val, const struct Mapping *map)
Lookup a string for a constant.
Definition mapping.c:42
#define IsPrint(ch)
Definition mbyte.h:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ km_expand_key()

bool km_expand_key ( struct Keymap * map,
struct Buffer * buf )

Get the key string bound to a Keymap.

Parameters
[in]mapKeybinding map
[out]bufBuffer for the result
Return values
trueSuccess

Definition at line 523 of file lib.c.

524{
525 if (!map || !buf)
526 return false;
527
528 for (int i = 0; i < map->len; i++)
529 {
530 km_keyname(map->keys[i], buf);
531 }
532
533 return true;
534}
void km_keyname(int c, struct Buffer *buf)
Get the human name for a key.
Definition lib.c:479
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ km_expand_key_string()

void km_expand_key_string ( char * str,
struct Buffer * buf )

Get a human-readable key string.

Parameters
[in]strRaw key string
[out]bufBuffer for the key string

Definition at line 541 of file lib.c.

542{
543 for (; *str; str++)
544 {
545 km_keyname(*str, buf);
546 }
547}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ km_find_func()

struct Keymap * km_find_func ( enum MenuType mtype,
int func )

Find a function's mapping in a Menu.

Parameters
mtypeMenu type, e.g. MENU_PAGER
funcFunction, e.g. OP_DELETE
Return values
ptrKeymap for the function

Definition at line 555 of file lib.c.

556{
557 struct Keymap *np = NULL;
558 STAILQ_FOREACH(np, &Keymaps[mtype], entries)
559 {
560 if (np->op == func)
561 break;
562 }
563 return np;
564}
struct KeymapList Keymaps[MENU_MAX]
Array of key mappings, one for each MenuType.
Definition lib.c:124
+ Here is the caller graph for this function:

◆ km_get_table()

const struct MenuFuncOp * km_get_table ( enum MenuType mtype)

Lookup a Menu's functions.

Parameters
mtypeMenu type, e.g. MENU_EDITOR
Return values
ptrArray of functions

Definition at line 571 of file lib.c.

572{
573 switch (mtype)
574 {
575 case MENU_ALIAS:
576 return OpAlias;
577 case MENU_ATTACHMENT:
578 return OpAttachment;
579#ifdef USE_AUTOCRYPT
580 case MENU_AUTOCRYPT:
581 return OpAutocrypt;
582#endif
583 case MENU_COMPOSE:
584 return OpCompose;
585 case MENU_DIALOG:
586 return OpDialog;
587 case MENU_EDITOR:
588 return OpEditor;
589 case MENU_FOLDER:
590 return OpBrowser;
591 case MENU_GENERIC:
592 return OpGeneric;
593 case MENU_INDEX:
594 return OpIndex;
595 case MENU_PAGER:
596 return OpPager;
597 case MENU_PGP:
598 return OpPgp;
599 case MENU_POSTPONED:
600 return OpPostponed;
601 case MENU_QUERY:
602 return OpQuery;
603 case MENU_SMIME:
604 return OpSmime;
605 default:
606 return NULL;
607 }
608}
const struct MenuFuncOp OpQuery[]
Functions for the external Query Menu.
Definition functions.c:76
const struct MenuFuncOp OpAlias[]
Functions for the Alias Menu.
Definition functions.c:60
const struct MenuFuncOp OpAttachment[]
Functions for the Attachment Menu.
Definition functions.c:62
const struct MenuFuncOp OpAutocrypt[]
Functions for the Autocrypt Account.
Definition functions.c:54
const struct MenuFuncOp OpBrowser[]
Functions for the file Browser Menu.
Definition functions.c:72
const struct MenuFuncOp OpCompose[]
Functions for the Compose Menu.
Definition functions.c:87
const struct MenuFuncOp OpEditor[]
Functions for the Editor Menu.
Definition functions.c:53
const struct MenuFuncOp OpGeneric[]
Functions for the Generic Menu.
Definition functions.c:69
const struct MenuFuncOp OpDialog[]
Functions for Simple Dialogs.
Definition functions.c:60
const struct MenuFuncOp OpIndex[]
Functions for the Index Menu.
Definition functions.c:90
const struct MenuFuncOp OpPostponed[]
Functions for the Postpone Menu.
Definition functions.c:52
const struct MenuFuncOp OpSmime[]
Functions for the Smime Menu.
Definition functions.c:52
const struct MenuFuncOp OpPager[]
Functions for the Pager Menu.
Definition functions.c:71
const struct MenuFuncOp OpPgp[]
Functions for the Pgp Menu.
Definition functions.c:42
@ MENU_INDEX
Index panel (list of emails)
Definition type.h:47
@ MENU_DIALOG
Simple Dialog.
Definition type.h:43
@ MENU_QUERY
Select from results of external query.
Definition type.h:51
@ MENU_AUTOCRYPT
Autocrypt Account menu.
Definition type.h:40
@ MENU_COMPOSE
Compose an email.
Definition type.h:42
@ MENU_ATTACHMENT
Select an attachment.
Definition type.h:38
@ MENU_PGP
PGP encryption menu.
Definition type.h:49
@ MENU_GENERIC
Generic selection list.
Definition type.h:46
@ MENU_PAGER
Pager pager (email viewer)
Definition type.h:48
@ MENU_SMIME
SMIME encryption menu.
Definition type.h:52
@ MENU_EDITOR
Text entry area.
Definition type.h:44
@ MENU_ALIAS
Select an email address by its alias.
Definition type.h:37
@ MENU_FOLDER
General file/mailbox browser.
Definition type.h:45
@ MENU_POSTPONED
Select a postponed email.
Definition type.h:50
+ Here is the caller graph for this function:

◆ help_lookup_function()

static const char * help_lookup_function ( int op,
enum MenuType menu )
static

Find a keybinding for an operation.

Parameters
opOperation, e.g. OP_DELETE
menuCurrent Menu, e.g. MENU_PAGER
Return values
strKey binding
NULLNo key binding found

Definition at line 617 of file lib.c.

618{
619 if ((menu != MENU_PAGER) && (menu != MENU_EDITOR) && (menu != MENU_GENERIC))
620 {
621 /* first look in the generic map for the function */
622 const char *fn_name = mutt_get_func(OpGeneric, op);
623 if (fn_name)
624 return fn_name;
625 }
626
627 const struct MenuFuncOp *funcs = km_get_table(menu);
628
629 return mutt_get_func(funcs, op);
630}
const char * mutt_get_func(const struct MenuFuncOp *funcs, int op)
Get the name of a function.
Definition lib.c:320
const struct MenuFuncOp * km_get_table(enum MenuType mtype)
Lookup a Menu's functions.
Definition lib.c:571
Mapping between a function and an operation.
Definition lib.h:115
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gather_menu()

void gather_menu ( enum MenuType menu,
struct BindingInfoArray * bia_bind,
struct BindingInfoArray * bia_macro )

Gather info about one menu.

Parameters
menuMenu type
bia_bindArray for bind results (may be NULL)
bia_macroArray for macro results (may be NULL)

Definition at line 638 of file lib.c.

640{
641 struct Buffer *key_binding = buf_pool_get();
642 struct Buffer *macro = buf_pool_get();
643
644 struct Keymap *map = NULL;
645 STAILQ_FOREACH(map, &Keymaps[menu], entries)
646 {
647 struct BindingInfo bi = { 0 };
648
649 buf_reset(key_binding);
650 km_expand_key(map, key_binding);
651
652 if (map->op == OP_MACRO)
653 {
654 if (!bia_macro || (map->op == OP_NULL))
655 continue;
656
657 buf_reset(macro);
658 escape_macro(map->macro, macro);
659 bi.a[0] = buf_strdup(key_binding);
660 bi.a[1] = buf_strdup(macro);
661 bi.a[2] = map->desc;
662 ARRAY_ADD(bia_macro, bi);
663 }
664 else
665 {
666 if (!bia_bind)
667 continue;
668
669 if (map->op == OP_NULL)
670 {
671 bi.a[0] = buf_strdup(key_binding);
672 bi.a[1] = "noop";
673 ARRAY_ADD(bia_bind, bi);
674 continue;
675 }
676
677 bi.a[0] = buf_strdup(key_binding);
678 bi.a[1] = help_lookup_function(map->op, menu);
679 bi.a[2] = _(opcodes_get_description(map->op));
680 ARRAY_ADD(bia_bind, bi);
681 }
682 }
683
684 buf_pool_release(&key_binding);
685 buf_pool_release(&macro);
686}
void buf_reset(struct Buffer *buf)
Reset an existing Buffer.
Definition buffer.c:76
char * buf_strdup(const struct Buffer *buf)
Copy a Buffer's string.
Definition buffer.c:571
static const char * help_lookup_function(int op, enum MenuType menu)
Find a keybinding for an operation.
Definition lib.c:617
void escape_macro(const char *macro, struct Buffer *buf)
Escape any special characters in a macro.
Definition lib.c:341
bool km_expand_key(struct Keymap *map, struct Buffer *buf)
Get the key string bound to a Keymap.
Definition lib.c:523
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
Definition pool.c:82
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Definition pool.c:96
String manipulation buffer.
Definition buffer.h:36
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ OpAlias

const struct MenuFuncOp OpAlias[]
extern

Functions for the Alias Menu.

Definition at line 60 of file functions.c.

60 { /* map: alias */
61 { "delete-entry", OP_DELETE },
62 { "exit", OP_EXIT },
63 { "limit", OP_MAIN_LIMIT },
64 { "mail", OP_MAIL },
65 { "sort-alias", OP_SORT },
66 { "sort-alias-reverse", OP_SORT_REVERSE },
67 { "tag-pattern", OP_MAIN_TAG_PATTERN },
68 { "undelete-entry", OP_UNDELETE },
69 { "untag-pattern", OP_MAIN_UNTAG_PATTERN },
70 { NULL, 0 },
71};

◆ OpAttachment

const struct MenuFuncOp OpAttachment[]
extern

Functions for the Attachment Menu.

Definition at line 62 of file functions.c.

62 { /* map: attachment */
63 { "bounce-message", OP_BOUNCE_MESSAGE },
64 { "check-traditional-pgp", OP_CHECK_TRADITIONAL },
65 { "collapse-parts", OP_ATTACHMENT_COLLAPSE },
66 { "compose-to-sender", OP_COMPOSE_TO_SENDER },
67 { "delete-entry", OP_ATTACHMENT_DELETE },
68 { "display-toggle-weed", OP_DISPLAY_HEADERS },
69 { "edit-type", OP_ATTACHMENT_EDIT_TYPE },
70 { "exit", OP_EXIT },
71 { "extract-keys", OP_EXTRACT_KEYS },
72 { "followup-message", OP_FOLLOWUP },
73 { "forget-passphrase", OP_FORGET_PASSPHRASE },
74 { "forward-message", OP_FORWARD_MESSAGE },
75 { "forward-to-group", OP_FORWARD_TO_GROUP },
76 { "group-chat-reply", OP_GROUP_CHAT_REPLY },
77 { "group-reply", OP_GROUP_REPLY },
78 { "list-reply", OP_LIST_REPLY },
79 { "list-subscribe", OP_LIST_SUBSCRIBE },
80 { "list-unsubscribe", OP_LIST_UNSUBSCRIBE },
81 { "pipe-entry", OP_PIPE },
82 { "pipe-message", OP_PIPE },
83 { "print-entry", OP_ATTACHMENT_PRINT },
84 { "reply", OP_REPLY },
85 { "resend-message", OP_RESEND },
86 { "save-entry", OP_ATTACHMENT_SAVE },
87 { "undelete-entry", OP_ATTACHMENT_UNDELETE },
88 { "view-attach", OP_ATTACHMENT_VIEW },
89 { "view-mailcap", OP_ATTACHMENT_VIEW_MAILCAP },
90 { "view-pager", OP_ATTACHMENT_VIEW_PAGER },
91 { "view-text", OP_ATTACHMENT_VIEW_TEXT },
92 { NULL, 0 },
93};

◆ OpAutocrypt

const struct MenuFuncOp OpAutocrypt[]
extern

Functions for the Autocrypt Account.

Definition at line 54 of file functions.c.

54 { /* map: autocrypt account */
55 { "create-account", OP_AUTOCRYPT_CREATE_ACCT },
56 { "delete-account", OP_AUTOCRYPT_DELETE_ACCT },
57 { "exit", OP_EXIT },
58 { "toggle-active", OP_AUTOCRYPT_TOGGLE_ACTIVE },
59 { "toggle-prefer-encrypt", OP_AUTOCRYPT_TOGGLE_PREFER },
60 { NULL, 0 }
61};

◆ OpBrowser

const struct MenuFuncOp OpBrowser[]
extern

Functions for the file Browser Menu.

Definition at line 72 of file functions.c.

72 { /* map: browser */
73 { "catchup", OP_CATCHUP },
74 { "change-dir", OP_CHANGE_DIRECTORY },
75 { "check-new", OP_CHECK_NEW },
76 { "create-mailbox", OP_CREATE_MAILBOX },
77 { "delete-mailbox", OP_DELETE_MAILBOX },
78 { "descend-directory", OP_DESCEND_DIRECTORY },
79 { "display-filename", OP_BROWSER_TELL },
80 { "enter-mask", OP_ENTER_MASK },
81 { "exit", OP_EXIT },
82 { "goto-folder", OP_BROWSER_GOTO_FOLDER },
83 { "goto-parent", OP_GOTO_PARENT },
84 { "mailbox-list", OP_MAILBOX_LIST },
85 { "reload-active", OP_LOAD_ACTIVE },
86 { "rename-mailbox", OP_RENAME_MAILBOX },
87 { "select-new", OP_BROWSER_NEW_FILE },
88 { "sort", OP_SORT },
89 { "sort-reverse", OP_SORT_REVERSE },
90 { "subscribe", OP_BROWSER_SUBSCRIBE },
91 { "subscribe-pattern", OP_SUBSCRIBE_PATTERN },
92 { "toggle-mailboxes", OP_TOGGLE_MAILBOXES },
93 { "toggle-subscribed", OP_BROWSER_TOGGLE_LSUB },
94 { "uncatchup", OP_UNCATCHUP },
95 { "unsubscribe", OP_BROWSER_UNSUBSCRIBE },
96 { "unsubscribe-pattern", OP_UNSUBSCRIBE_PATTERN },
97 { "view-file", OP_BROWSER_VIEW_FILE },
98 // Deprecated
99 { "buffy-list", OP_MAILBOX_LIST, OP_DEPRECATED },
100 { NULL, 0 },
101};
#define OP_DEPRECATED
Convenience symbol.
Definition lib.h:109

◆ OpCompose

const struct MenuFuncOp OpCompose[]
extern

Functions for the Compose Menu.

Definition at line 87 of file functions.c.

87 { /* map: compose */
88 { "attach-file", OP_ATTACHMENT_ATTACH_FILE },
89 { "attach-key", OP_ATTACHMENT_ATTACH_KEY },
90 { "attach-message", OP_ATTACHMENT_ATTACH_MESSAGE },
91 { "attach-news-message", OP_ATTACHMENT_ATTACH_NEWS_MESSAGE },
92#ifdef USE_AUTOCRYPT
93 { "autocrypt-menu", OP_COMPOSE_AUTOCRYPT_MENU },
94#endif
95 { "copy-file", OP_ATTACHMENT_SAVE },
96 { "detach-file", OP_ATTACHMENT_DETACH },
97 { "display-toggle-weed", OP_DISPLAY_HEADERS },
98 { "edit-bcc", OP_ENVELOPE_EDIT_BCC },
99 { "edit-cc", OP_ENVELOPE_EDIT_CC },
100 { "edit-content-id", OP_ATTACHMENT_EDIT_CONTENT_ID },
101 { "edit-description", OP_ATTACHMENT_EDIT_DESCRIPTION },
102 { "edit-encoding", OP_ATTACHMENT_EDIT_ENCODING },
103 { "edit-fcc", OP_ENVELOPE_EDIT_FCC },
104 { "edit-file", OP_COMPOSE_EDIT_FILE },
105 { "edit-followup-to", OP_ENVELOPE_EDIT_FOLLOWUP_TO },
106 { "edit-from", OP_ENVELOPE_EDIT_FROM },
107 { "edit-headers", OP_ENVELOPE_EDIT_HEADERS },
108 { "edit-language", OP_ATTACHMENT_EDIT_LANGUAGE },
109 { "edit-message", OP_COMPOSE_EDIT_MESSAGE },
110 { "edit-mime", OP_ATTACHMENT_EDIT_MIME },
111 { "edit-newsgroups", OP_ENVELOPE_EDIT_NEWSGROUPS },
112 { "edit-reply-to", OP_ENVELOPE_EDIT_REPLY_TO },
113 { "edit-subject", OP_ENVELOPE_EDIT_SUBJECT },
114 { "edit-to", OP_ENVELOPE_EDIT_TO },
115 { "edit-type", OP_ATTACHMENT_EDIT_TYPE },
116 { "edit-x-comment-to", OP_ENVELOPE_EDIT_X_COMMENT_TO },
117 { "exit", OP_EXIT },
118 { "filter-entry", OP_ATTACHMENT_FILTER },
119 { "forget-passphrase", OP_FORGET_PASSPHRASE },
120 { "get-attachment", OP_ATTACHMENT_GET_ATTACHMENT },
121 { "group-alternatives", OP_ATTACHMENT_GROUP_ALTS },
122 { "group-multilingual", OP_ATTACHMENT_GROUP_LINGUAL },
123 { "group-related", OP_ATTACHMENT_GROUP_RELATED },
124 { "ispell", OP_COMPOSE_ISPELL },
125 { "move-down", OP_ATTACHMENT_MOVE_DOWN },
126 { "move-up", OP_ATTACHMENT_MOVE_UP },
127 { "new-mime", OP_ATTACHMENT_NEW_MIME },
128 { "pgp-menu", OP_COMPOSE_PGP_MENU },
129 { "pipe-entry", OP_PIPE },
130 { "pipe-message", OP_PIPE },
131 { "postpone-message", OP_COMPOSE_POSTPONE_MESSAGE },
132 { "preview-page-down", OP_PREVIEW_PAGE_DOWN },
133 { "preview-page-up", OP_PREVIEW_PAGE_UP },
134 { "print-entry", OP_ATTACHMENT_PRINT },
135 { "rename-attachment", OP_ATTACHMENT_RENAME_ATTACHMENT },
136 { "rename-file", OP_COMPOSE_RENAME_FILE },
137 { "send-message", OP_COMPOSE_SEND_MESSAGE },
138 { "smime-menu", OP_COMPOSE_SMIME_MENU },
139 { "toggle-disposition", OP_ATTACHMENT_TOGGLE_DISPOSITION },
140 { "toggle-recode", OP_ATTACHMENT_TOGGLE_RECODE },
141 { "toggle-unlink", OP_ATTACHMENT_TOGGLE_UNLINK },
142 { "ungroup-attachment", OP_ATTACHMENT_UNGROUP },
143 { "update-encoding", OP_ATTACHMENT_UPDATE_ENCODING },
144 { "view-attach", OP_ATTACHMENT_VIEW },
145 { "view-mailcap", OP_ATTACHMENT_VIEW_MAILCAP },
146 { "view-pager", OP_ATTACHMENT_VIEW_PAGER },
147 { "view-text", OP_ATTACHMENT_VIEW_TEXT },
148 { "write-fcc", OP_COMPOSE_WRITE_MESSAGE },
149 { NULL, 0 },
150};

◆ OpEditor

const struct MenuFuncOp OpEditor[]
extern

Functions for the Editor Menu.

Definition at line 53 of file functions.c.

53 { /* map: editor */
54 { "backspace", OP_EDITOR_BACKSPACE },
55 { "backward-char", OP_EDITOR_BACKWARD_CHAR },
56 { "backward-word", OP_EDITOR_BACKWARD_WORD },
57 { "bol", OP_EDITOR_BOL },
58 { "capitalize-word", OP_EDITOR_CAPITALIZE_WORD },
59 { "complete", OP_EDITOR_COMPLETE },
60 { "complete-query", OP_EDITOR_COMPLETE_QUERY },
61 { "delete-char", OP_EDITOR_DELETE_CHAR },
62 { "downcase-word", OP_EDITOR_DOWNCASE_WORD },
63 { "eol", OP_EDITOR_EOL },
64 { "forward-char", OP_EDITOR_FORWARD_CHAR },
65 { "forward-word", OP_EDITOR_FORWARD_WORD },
66 { "help", OP_HELP },
67 { "history-down", OP_EDITOR_HISTORY_DOWN },
68 { "history-search", OP_EDITOR_HISTORY_SEARCH },
69 { "history-up", OP_EDITOR_HISTORY_UP },
70 { "kill-eol", OP_EDITOR_KILL_EOL },
71 { "kill-eow", OP_EDITOR_KILL_EOW },
72 { "kill-line", OP_EDITOR_KILL_LINE },
73 { "kill-whole-line", OP_EDITOR_KILL_WHOLE_LINE },
74 { "kill-word", OP_EDITOR_KILL_WORD },
75 { "mailbox-cycle", OP_EDITOR_MAILBOX_CYCLE },
76 { "quote-char", OP_EDITOR_QUOTE_CHAR },
77 { "redraw-screen", OP_REDRAW },
78 { "transpose-chars", OP_EDITOR_TRANSPOSE_CHARS },
79 { "upcase-word", OP_EDITOR_UPCASE_WORD },
80 // Deprecated
81 { "buffy-cycle", OP_EDITOR_MAILBOX_CYCLE, OP_DEPRECATED },
82 { NULL, 0 },
83};

◆ OpIndex

const struct MenuFuncOp OpIndex[]
extern

Functions for the Index Menu.

Definition at line 90 of file functions.c.

90 { /* map: index */
91 { "alias-dialog", OP_ALIAS_DIALOG },
92#ifdef USE_AUTOCRYPT
93 { "autocrypt-acct-menu", OP_AUTOCRYPT_ACCT_MENU },
94#endif
95 { "bounce-message", OP_BOUNCE_MESSAGE },
96 { "break-thread", OP_MAIN_BREAK_THREAD },
97 { "catchup", OP_CATCHUP },
98 { "change-folder", OP_MAIN_CHANGE_FOLDER },
99 { "change-folder-readonly", OP_MAIN_CHANGE_FOLDER_READONLY },
100 { "change-newsgroup", OP_MAIN_CHANGE_GROUP },
101 { "change-newsgroup-readonly", OP_MAIN_CHANGE_GROUP_READONLY },
102#ifdef USE_NOTMUCH
103 { "change-vfolder", OP_MAIN_CHANGE_VFOLDER },
104#endif
105 { "check-traditional-pgp", OP_CHECK_TRADITIONAL },
106 { "clear-flag", OP_MAIN_CLEAR_FLAG },
107 { "collapse-all", OP_MAIN_COLLAPSE_ALL },
108 { "collapse-thread", OP_MAIN_COLLAPSE_THREAD },
109 { "compose-to-sender", OP_COMPOSE_TO_SENDER },
110 { "copy-message", OP_COPY_MESSAGE },
111 { "create-alias", OP_CREATE_ALIAS },
112 { "decode-copy", OP_DECODE_COPY },
113 { "decode-save", OP_DECODE_SAVE },
114 { "decrypt-copy", OP_DECRYPT_COPY },
115 { "decrypt-save", OP_DECRYPT_SAVE },
116 { "delete-message", OP_DELETE },
117 { "delete-pattern", OP_MAIN_DELETE_PATTERN },
118 { "delete-subthread", OP_DELETE_SUBTHREAD },
119 { "delete-thread", OP_DELETE_THREAD },
120 { "display-address", OP_DISPLAY_ADDRESS },
121 { "display-message", OP_DISPLAY_MESSAGE },
122 { "display-toggle-weed", OP_DISPLAY_HEADERS },
123 { "edit", OP_EDIT_RAW_MESSAGE },
124 { "edit-label", OP_EDIT_LABEL },
125 { "edit-or-view-raw-message", OP_EDIT_OR_VIEW_RAW_MESSAGE },
126 { "edit-raw-message", OP_EDIT_RAW_MESSAGE },
127 { "edit-type", OP_ATTACHMENT_EDIT_TYPE },
128#ifdef USE_NOTMUCH
129 { "entire-thread", OP_MAIN_ENTIRE_THREAD },
130#endif
131 { "exit", OP_EXIT },
132 { "extract-keys", OP_EXTRACT_KEYS },
133 { "fetch-mail", OP_MAIN_FETCH_MAIL },
134 { "flag-message", OP_FLAG_MESSAGE },
135 { "followup-message", OP_FOLLOWUP },
136 { "forget-passphrase", OP_FORGET_PASSPHRASE },
137 { "forward-message", OP_FORWARD_MESSAGE },
138 { "forward-to-group", OP_FORWARD_TO_GROUP },
139 { "get-children", OP_GET_CHILDREN },
140 { "get-message", OP_GET_MESSAGE },
141 { "get-parent", OP_GET_PARENT },
142 { "group-chat-reply", OP_GROUP_CHAT_REPLY },
143 { "group-reply", OP_GROUP_REPLY },
144 { "imap-fetch-mail", OP_MAIN_IMAP_FETCH },
145 { "imap-logout-all", OP_MAIN_IMAP_LOGOUT_ALL },
146 { "limit", OP_MAIN_LIMIT },
147 { "limit-current-thread", OP_LIMIT_CURRENT_THREAD },
148 { "link-threads", OP_MAIN_LINK_THREADS },
149 { "list-reply", OP_LIST_REPLY },
150 { "list-subscribe", OP_LIST_SUBSCRIBE },
151 { "list-unsubscribe", OP_LIST_UNSUBSCRIBE },
152 { "mail", OP_MAIL },
153 { "mail-key", OP_MAIL_KEY },
154 { "mailbox-list", OP_MAILBOX_LIST },
155 { "mark-message", OP_MARK_MSG },
156 { "modify-labels", OP_MAIN_MODIFY_TAGS },
157 { "modify-labels-then-hide", OP_MAIN_MODIFY_TAGS_THEN_HIDE },
158 { "modify-tags", OP_MAIN_MODIFY_TAGS },
159 { "modify-tags-then-hide", OP_MAIN_MODIFY_TAGS_THEN_HIDE },
160 { "next-new", OP_MAIN_NEXT_NEW },
161 { "next-new-then-unread", OP_MAIN_NEXT_NEW_THEN_UNREAD },
162 { "next-subthread", OP_MAIN_NEXT_SUBTHREAD },
163 { "next-thread", OP_MAIN_NEXT_THREAD },
164 { "next-undeleted", OP_MAIN_NEXT_UNDELETED },
165 { "next-unread", OP_MAIN_NEXT_UNREAD },
166 { "next-unread-mailbox", OP_MAIN_NEXT_UNREAD_MAILBOX },
167 { "parent-message", OP_MAIN_PARENT_MESSAGE },
168 { "pipe-entry", OP_PIPE },
169 { "pipe-message", OP_PIPE },
170 { "post-message", OP_POST },
171 { "previous-new", OP_MAIN_PREV_NEW },
172 { "previous-new-then-unread", OP_MAIN_PREV_NEW_THEN_UNREAD },
173 { "previous-subthread", OP_MAIN_PREV_SUBTHREAD },
174 { "previous-thread", OP_MAIN_PREV_THREAD },
175 { "previous-undeleted", OP_MAIN_PREV_UNDELETED },
176 { "previous-unread", OP_MAIN_PREV_UNREAD },
177 { "print-message", OP_PRINT },
178 { "purge-message", OP_PURGE_MESSAGE },
179 { "purge-thread", OP_PURGE_THREAD },
180 { "quasi-delete", OP_MAIN_QUASI_DELETE },
181 { "query", OP_QUERY },
182 { "quit", OP_QUIT },
183 { "read-subthread", OP_MAIN_READ_SUBTHREAD },
184 { "read-thread", OP_MAIN_READ_THREAD },
185 { "recall-message", OP_RECALL_MESSAGE },
186 { "reconstruct-thread", OP_RECONSTRUCT_THREAD },
187 { "reply", OP_REPLY },
188 { "resend-message", OP_RESEND },
189 { "root-message", OP_MAIN_ROOT_MESSAGE },
190 { "save-message", OP_SAVE },
191 { "set-flag", OP_MAIN_SET_FLAG },
192 { "show-limit", OP_MAIN_SHOW_LIMIT },
193 { "sidebar-first", OP_SIDEBAR_FIRST },
194 { "sidebar-last", OP_SIDEBAR_LAST },
195 { "sidebar-next", OP_SIDEBAR_NEXT },
196 { "sidebar-next-new", OP_SIDEBAR_NEXT_NEW },
197 { "sidebar-open", OP_SIDEBAR_OPEN },
198 { "sidebar-page-down", OP_SIDEBAR_PAGE_DOWN },
199 { "sidebar-page-up", OP_SIDEBAR_PAGE_UP },
200 { "sidebar-prev", OP_SIDEBAR_PREV },
201 { "sidebar-prev-new", OP_SIDEBAR_PREV_NEW },
202 { "sidebar-toggle-virtual", OP_SIDEBAR_TOGGLE_VIRTUAL },
203 { "sidebar-toggle-visible", OP_SIDEBAR_TOGGLE_VISIBLE },
204 { "sort-mailbox", OP_SORT },
205 { "sort-reverse", OP_SORT_REVERSE },
206 { "sync-mailbox", OP_MAIN_SYNC_FOLDER },
207 { "tag-pattern", OP_MAIN_TAG_PATTERN },
208 { "tag-subthread", OP_TAG_SUBTHREAD },
209 { "tag-thread", OP_TAG_THREAD },
210 { "toggle-new", OP_TOGGLE_NEW },
211 { "toggle-read", OP_TOGGLE_READ },
212 { "toggle-write", OP_TOGGLE_WRITE },
213 { "undelete-message", OP_UNDELETE },
214 { "undelete-pattern", OP_MAIN_UNDELETE_PATTERN },
215 { "undelete-subthread", OP_UNDELETE_SUBTHREAD },
216 { "undelete-thread", OP_UNDELETE_THREAD },
217 { "untag-pattern", OP_MAIN_UNTAG_PATTERN },
218#ifdef USE_NOTMUCH
219 { "vfolder-from-query", OP_MAIN_VFOLDER_FROM_QUERY },
220 { "vfolder-from-query-readonly", OP_MAIN_VFOLDER_FROM_QUERY_READONLY },
221 { "vfolder-window-backward", OP_MAIN_WINDOWED_VFOLDER_BACKWARD },
222 { "vfolder-window-forward", OP_MAIN_WINDOWED_VFOLDER_FORWARD },
223 { "vfolder-window-reset", OP_MAIN_WINDOWED_VFOLDER_RESET },
224#endif
225 { "view-attachments", OP_VIEW_ATTACHMENTS },
226 { "view-raw-message", OP_VIEW_RAW_MESSAGE },
227 // Deprecated
228 { "buffy-list", OP_MAILBOX_LIST, OP_DEPRECATED },
229 { NULL, 0 },
230};

◆ OpPager

const struct MenuFuncOp OpPager[]
extern

Functions for the Pager Menu.

Definition at line 71 of file functions.c.

71 { /* map: pager */
72 { "bottom", OP_PAGER_BOTTOM },
73 { "bounce-message", OP_BOUNCE_MESSAGE },
74 { "break-thread", OP_MAIN_BREAK_THREAD },
75 { "change-folder", OP_MAIN_CHANGE_FOLDER },
76 { "change-folder-readonly", OP_MAIN_CHANGE_FOLDER_READONLY },
77 { "change-newsgroup", OP_MAIN_CHANGE_GROUP },
78 { "change-newsgroup-readonly", OP_MAIN_CHANGE_GROUP_READONLY },
79#ifdef USE_NOTMUCH
80 { "change-vfolder", OP_MAIN_CHANGE_VFOLDER },
81#endif
82 { "check-stats", OP_CHECK_STATS },
83 { "check-traditional-pgp", OP_CHECK_TRADITIONAL },
84 { "clear-flag", OP_MAIN_CLEAR_FLAG },
85 { "compose-to-sender", OP_COMPOSE_TO_SENDER },
86 { "copy-message", OP_COPY_MESSAGE },
87 { "create-alias", OP_CREATE_ALIAS },
88 { "decode-copy", OP_DECODE_COPY },
89 { "decode-save", OP_DECODE_SAVE },
90 { "decrypt-copy", OP_DECRYPT_COPY },
91 { "decrypt-save", OP_DECRYPT_SAVE },
92 { "delete-message", OP_DELETE },
93 { "delete-subthread", OP_DELETE_SUBTHREAD },
94 { "delete-thread", OP_DELETE_THREAD },
95 { "display-address", OP_DISPLAY_ADDRESS },
96 { "display-toggle-weed", OP_DISPLAY_HEADERS },
97 { "edit", OP_EDIT_RAW_MESSAGE },
98 { "edit-label", OP_EDIT_LABEL },
99 { "edit-or-view-raw-message", OP_EDIT_OR_VIEW_RAW_MESSAGE },
100 { "edit-raw-message", OP_EDIT_RAW_MESSAGE },
101 { "edit-type", OP_ATTACHMENT_EDIT_TYPE },
102 { "enter-command", OP_ENTER_COMMAND },
103#ifdef USE_NOTMUCH
104 { "entire-thread", OP_MAIN_ENTIRE_THREAD },
105#endif
106 { "exit", OP_EXIT },
107 { "extract-keys", OP_EXTRACT_KEYS },
108 { "flag-message", OP_FLAG_MESSAGE },
109 { "followup-message", OP_FOLLOWUP },
110 { "forget-passphrase", OP_FORGET_PASSPHRASE },
111 { "forward-message", OP_FORWARD_MESSAGE },
112 { "forward-to-group", OP_FORWARD_TO_GROUP },
113 { "group-chat-reply", OP_GROUP_CHAT_REPLY },
114 { "group-reply", OP_GROUP_REPLY },
115 { "half-down", OP_HALF_DOWN },
116 { "half-up", OP_HALF_UP },
117 { "help", OP_HELP },
118 { "imap-fetch-mail", OP_MAIN_IMAP_FETCH },
119 { "imap-logout-all", OP_MAIN_IMAP_LOGOUT_ALL },
120 { "jump", OP_JUMP },
121 { "jump", OP_JUMP_1 },
122 { "jump", OP_JUMP_2 },
123 { "jump", OP_JUMP_3 },
124 { "jump", OP_JUMP_4 },
125 { "jump", OP_JUMP_5 },
126 { "jump", OP_JUMP_6 },
127 { "jump", OP_JUMP_7 },
128 { "jump", OP_JUMP_8 },
129 { "jump", OP_JUMP_9 },
130 { "link-threads", OP_MAIN_LINK_THREADS },
131 { "list-reply", OP_LIST_REPLY },
132 { "list-subscribe", OP_LIST_SUBSCRIBE },
133 { "list-unsubscribe", OP_LIST_UNSUBSCRIBE },
134 { "mail", OP_MAIL },
135 { "mail-key", OP_MAIL_KEY },
136 { "mailbox-list", OP_MAILBOX_LIST },
137 { "mark-as-new", OP_TOGGLE_NEW },
138 { "modify-labels", OP_MAIN_MODIFY_TAGS },
139 { "modify-labels-then-hide", OP_MAIN_MODIFY_TAGS_THEN_HIDE },
140 { "modify-tags", OP_MAIN_MODIFY_TAGS },
141 { "modify-tags-then-hide", OP_MAIN_MODIFY_TAGS_THEN_HIDE },
142 { "next-entry", OP_NEXT_ENTRY },
143 { "next-line", OP_NEXT_LINE },
144 { "next-new", OP_MAIN_NEXT_NEW },
145 { "next-new-then-unread", OP_MAIN_NEXT_NEW_THEN_UNREAD },
146 { "next-page", OP_NEXT_PAGE },
147 { "next-subthread", OP_MAIN_NEXT_SUBTHREAD },
148 { "next-thread", OP_MAIN_NEXT_THREAD },
149 { "next-undeleted", OP_MAIN_NEXT_UNDELETED },
150 { "next-unread", OP_MAIN_NEXT_UNREAD },
151 { "next-unread-mailbox", OP_MAIN_NEXT_UNREAD_MAILBOX },
152 { "parent-message", OP_MAIN_PARENT_MESSAGE },
153 { "pipe-entry", OP_PIPE },
154 { "pipe-message", OP_PIPE },
155 { "post-message", OP_POST },
156 { "previous-entry", OP_PREV_ENTRY },
157 { "previous-line", OP_PREV_LINE },
158 { "previous-new", OP_MAIN_PREV_NEW },
159 { "previous-new-then-unread", OP_MAIN_PREV_NEW_THEN_UNREAD },
160 { "previous-page", OP_PREV_PAGE },
161 { "previous-subthread", OP_MAIN_PREV_SUBTHREAD },
162 { "previous-thread", OP_MAIN_PREV_THREAD },
163 { "previous-undeleted", OP_MAIN_PREV_UNDELETED },
164 { "previous-unread", OP_MAIN_PREV_UNREAD },
165 { "print-entry", OP_ATTACHMENT_PRINT },
166 { "print-message", OP_PRINT },
167 { "purge-message", OP_PURGE_MESSAGE },
168 { "purge-thread", OP_PURGE_THREAD },
169 { "quasi-delete", OP_MAIN_QUASI_DELETE },
170 { "quit", OP_QUIT },
171 { "read-subthread", OP_MAIN_READ_SUBTHREAD },
172 { "read-thread", OP_MAIN_READ_THREAD },
173 { "recall-message", OP_RECALL_MESSAGE },
174 { "reconstruct-thread", OP_RECONSTRUCT_THREAD },
175 { "redraw-screen", OP_REDRAW },
176 { "reply", OP_REPLY },
177 { "resend-message", OP_RESEND },
178 { "root-message", OP_MAIN_ROOT_MESSAGE },
179 { "save-entry", OP_ATTACHMENT_SAVE },
180 { "save-message", OP_SAVE },
181 { "search", OP_SEARCH },
182 { "search-next", OP_SEARCH_NEXT },
183 { "search-opposite", OP_SEARCH_OPPOSITE },
184 { "search-reverse", OP_SEARCH_REVERSE },
185 { "search-toggle", OP_SEARCH_TOGGLE },
186 { "set-flag", OP_MAIN_SET_FLAG },
187 { "shell-escape", OP_SHELL_ESCAPE },
188 { "show-log-messages", OP_SHOW_LOG_MESSAGES },
189 { "show-version", OP_VERSION },
190 { "sidebar-first", OP_SIDEBAR_FIRST },
191 { "sidebar-last", OP_SIDEBAR_LAST },
192 { "sidebar-next", OP_SIDEBAR_NEXT },
193 { "sidebar-next-new", OP_SIDEBAR_NEXT_NEW },
194 { "sidebar-open", OP_SIDEBAR_OPEN },
195 { "sidebar-page-down", OP_SIDEBAR_PAGE_DOWN },
196 { "sidebar-page-up", OP_SIDEBAR_PAGE_UP },
197 { "sidebar-prev", OP_SIDEBAR_PREV },
198 { "sidebar-prev-new", OP_SIDEBAR_PREV_NEW },
199 { "sidebar-toggle-virtual", OP_SIDEBAR_TOGGLE_VIRTUAL },
200 { "sidebar-toggle-visible", OP_SIDEBAR_TOGGLE_VISIBLE },
201 { "skip-headers", OP_PAGER_SKIP_HEADERS },
202 { "skip-quoted", OP_PAGER_SKIP_QUOTED },
203 { "sort-mailbox", OP_SORT },
204 { "sort-reverse", OP_SORT_REVERSE },
205 { "sync-mailbox", OP_MAIN_SYNC_FOLDER },
206 { "tag-message", OP_TAG },
207 { "toggle-quoted", OP_PAGER_HIDE_QUOTED },
208 { "toggle-write", OP_TOGGLE_WRITE },
209 { "top", OP_PAGER_TOP },
210 { "undelete-message", OP_UNDELETE },
211 { "undelete-subthread", OP_UNDELETE_SUBTHREAD },
212 { "undelete-thread", OP_UNDELETE_THREAD },
213#ifdef USE_NOTMUCH
214 { "vfolder-from-query", OP_MAIN_VFOLDER_FROM_QUERY },
215 { "vfolder-from-query-readonly", OP_MAIN_VFOLDER_FROM_QUERY_READONLY },
216#endif
217 { "view-attachments", OP_VIEW_ATTACHMENTS },
218 { "view-raw-message", OP_VIEW_RAW_MESSAGE },
219 { "what-key", OP_WHAT_KEY },
220 // Deprecated
221 { "buffy-list", OP_MAILBOX_LIST, OP_DEPRECATED },
222 { "error-history", OP_SHOW_LOG_MESSAGES, OP_DEPRECATED },
223 { NULL, 0 },
224};

◆ OpPgp

const struct MenuFuncOp OpPgp[]
extern

Functions for the Pgp Menu.

Definition at line 42 of file functions.c.

42 { /* map: pgp */
43 { "exit", OP_EXIT },
44 { "verify-key", OP_VERIFY_KEY },
45 { "view-name", OP_VIEW_ID },
46 { NULL, 0 },
47};

◆ OpPostponed

const struct MenuFuncOp OpPostponed[]
extern

Functions for the Postpone Menu.

Definition at line 52 of file functions.c.

52 { /* map: postpone */
53 { "exit", OP_EXIT },
54 { "delete-entry", OP_DELETE },
55 { "undelete-entry", OP_UNDELETE },
56 { NULL, 0 },
57};

◆ OpQuery

const struct MenuFuncOp OpQuery[]
extern

Functions for the external Query Menu.

Definition at line 76 of file functions.c.

76 { /* map: query */
77 { "create-alias", OP_CREATE_ALIAS },
78 { "exit", OP_EXIT },
79 { "limit", OP_MAIN_LIMIT },
80 { "mail", OP_MAIL },
81 { "query", OP_QUERY },
82 { "query-append", OP_QUERY_APPEND },
83 { "sort", OP_SORT },
84 { "sort-reverse", OP_SORT_REVERSE },
85 { "tag-pattern", OP_MAIN_TAG_PATTERN },
86 { "untag-pattern", OP_MAIN_UNTAG_PATTERN },
87 { NULL, 0 },
88};

◆ OpSmime

const struct MenuFuncOp OpSmime[]
extern

Functions for the Smime Menu.

Definition at line 52 of file functions.c.

52 { /* map: smime */
53 { "exit", OP_EXIT },
54#ifdef CRYPT_BACKEND_GPGME
55 { "verify-key", OP_VERIFY_KEY },
56 { "view-name", OP_VIEW_ID },
57#endif
58 { NULL, 0 },
59};

◆ KeyNames

struct Mapping KeyNames[]

Key name lookup table.

Definition at line 59 of file lib.c.

59 {
60 { "<PageUp>", KEY_PPAGE },
61 { "<PageDown>", KEY_NPAGE },
62 { "<Up>", KEY_UP },
63 { "<Down>", KEY_DOWN },
64 { "<Right>", KEY_RIGHT },
65 { "<Left>", KEY_LEFT },
66 { "<Delete>", KEY_DC },
67 { "<BackSpace>", KEY_BACKSPACE },
68 { "<Insert>", KEY_IC },
69 { "<Home>", KEY_HOME },
70 { "<End>", KEY_END },
71 { "<Enter>", '\n' },
72 { "<Return>", '\r' },
73#ifdef KEY_ENTER
74 { "<KeypadEnter>", KEY_ENTER },
75#else
76 { "<KeypadEnter>", '\n' },
77#endif
78 { "<Esc>", '\033' }, // Escape
79 { "<Tab>", '\t' },
80 { "<Space>", ' ' },
81#ifdef KEY_BTAB
82 { "<BackTab>", KEY_BTAB },
83#endif
84#ifdef KEY_NEXT
85 { "<Next>", KEY_NEXT },
86#endif
87 /* extensions supported by ncurses. values are filled in during initialization */
88
89 /* CTRL+key */
90 { "<C-Up>", -1 },
91 { "<C-Down>", -1 },
92 { "<C-Left>", -1 },
93 { "<C-Right>", -1 },
94 { "<C-Home>", -1 },
95 { "<C-End>", -1 },
96 { "<C-Next>", -1 },
97 { "<C-Prev>", -1 },
98
99 /* SHIFT+key */
100 { "<S-Up>", -1 },
101 { "<S-Down>", -1 },
102 { "<S-Left>", -1 },
103 { "<S-Right>", -1 },
104 { "<S-Home>", -1 },
105 { "<S-End>", -1 },
106 { "<S-Next>", -1 },
107 { "<S-Prev>", -1 },
108
109 /* ALT+key */
110 { "<A-Up>", -1 },
111 { "<A-Down>", -1 },
112 { "<A-Left>", -1 },
113 { "<A-Right>", -1 },
114 { "<A-Home>", -1 },
115 { "<A-End>", -1 },
116 { "<A-Next>", -1 },
117 { "<A-Prev>", -1 },
118 { NULL, 0 },
119};

◆ AbortKey

keycode_t AbortKey

code of key to abort prompts, normally Ctrl-G

key to abort edits etc, normally Ctrl-G

Definition at line 121 of file lib.c.

◆ Keymaps

struct KeymapList Keymaps[MENU_MAX]

Array of key mappings, one for each MenuType.

Array of Keymap keybindings, one for each Menu.

Definition at line 124 of file lib.c.