Key helper functions. More...
#include "config.h"
#include <ctype.h>
#include <limits.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "mutt/lib.h"
#include "gui/lib.h"
#include "key/lib.h"
#include "menu/lib.h"
#include "ncrypt/lib.h"
Go to the source code of this file.
Functions | |
void | mutt_keymap_free (struct Keymap **ptr) |
Free a Keymap. | |
struct Keymap * | alloc_keys (size_t len, keycode_t *keys) |
Allocate space for a sequence of keys. | |
static 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 Keymap * | km_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 | generic_tokenize_push_string (char *s) |
Parse and queue a 'push' command. | |
const char * | km_keyname (int c) |
Get the human name for a key. | |
int | km_expand_key (char *s, size_t len, struct Keymap *map) |
Get the key string bound to a Keymap. | |
int | km_expand_key_string (char *str, char *buf, size_t buflen) |
Get a human-readable key string. | |
struct Keymap * | km_find_func (enum MenuType mtype, int func) |
Find a function's mapping in a Menu. | |
const struct MenuFuncOp * | km_get_table (enum MenuType mtype) |
Lookup a Menu's functions. | |
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. | |
Key helper functions.
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.
void mutt_keymap_free | ( | struct Keymap ** | ptr | ) |
Allocate space for a sequence of keys.
len | Number of keys |
keys | Array of keys |
ptr | Sequence of keys |
Definition at line 150 of file lib.c.
|
static |
Parse a function key string.
s | String to parse |
num | Number of the key |
Given "<f8>", it will return 8.
Definition at line 166 of file lib.c.
|
static |
Parse a numeric keycode.
s | String to parse |
num | Number of the key |
This function parses the string <NNN>
and uses the octal value as the key to bind.
Definition at line 193 of file lib.c.
size_t parsekeys | ( | const char * | str, |
keycode_t * | d, | ||
size_t | max | ||
) |
Parse a key string into key codes.
str | Key string |
d | Array for key codes |
max | Maximum length of key sequence |
num | Length of key sequence |
Definition at line 216 of file lib.c.
Compare two keymaps' keyscodes and return the bigger one.
k1 | first keymap to compare |
k2 | second keymap to compare |
pos | position where the two keycodes differ |
ptr | Keymap with a bigger ASCII keycode |
Definition at line 275 of file lib.c.
int get_op | ( | const struct MenuFuncOp * | funcs, |
const char * | start, | ||
size_t | len | ||
) |
Get the function by its name.
funcs | Functions table |
start | Name of function to find |
len | Length of string to match |
num | Operation, e.g. OP_DELETE |
Definition at line 299 of file lib.c.
const char * mutt_get_func | ( | const struct MenuFuncOp * | funcs, |
int | op | ||
) |
Get the name of a function.
funcs | Functions table |
op | Operation, e.g. OP_DELETE |
ptr | Name of function |
NULL | Operation not found |
Definition at line 321 of file lib.c.
void generic_tokenize_push_string | ( | char * | s | ) |
Parse and queue a 'push' command.
s | String to push into the key queue |
Parses s for <function>
syntax and adds the whole sequence the macro buffer.
Definition at line 338 of file lib.c.
const char * km_keyname | ( | int | c | ) |
Get the human name for a key.
c | Key code |
ptr | Name of the key |
Definition at line 410 of file lib.c.
int km_expand_key | ( | char * | s, |
size_t | len, | ||
struct Keymap * | map | ||
) |
Get the key string bound to a Keymap.
s | Buffer for the key string |
len | Length of buffer |
map | Keybinding map |
1 | Success |
0 | Error |
Definition at line 457 of file lib.c.
int km_expand_key_string | ( | char * | str, |
char * | buf, | ||
size_t | buflen | ||
) |
Get a human-readable key string.
str | Raw key string |
buf | Buffer for the key string |
buflen | Length of buffer |
num | Length of string |
Definition at line 486 of file lib.c.
Find a function's mapping in a Menu.
mtype | Menu type, e.g. MENU_PAGER |
func | Function, e.g. OP_DELETE |
ptr | Keymap for the function |
Definition at line 509 of file lib.c.
const struct MenuFuncOp * km_get_table | ( | enum MenuType | mtype | ) |
mtype | Menu type, e.g. MENU_EDITOR |
ptr | Array of functions |
Definition at line 525 of file lib.c.
|
extern |
Definition at line 60 of file functions.c.
|
extern |
Functions for the Attachment Menu.
Definition at line 62 of file functions.c.
|
extern |
Functions for the Autocrypt Account.
Definition at line 54 of file functions.c.
|
extern |
Functions for the file Browser Menu.
Definition at line 72 of file functions.c.
|
extern |
Functions for the Compose Menu.
Definition at line 87 of file functions.c.
|
extern |
Functions for the Editor Menu.
Definition at line 53 of file functions.c.
|
extern |
Functions for the Index Menu.
Definition at line 90 of file functions.c.
|
extern |
Functions for the Pager Menu.
Definition at line 71 of file functions.c.
|
extern |
Functions for the Pgp Menu.
Definition at line 42 of file functions.c.
|
extern |
Functions for the Postpone Menu.
Definition at line 52 of file functions.c.
|
extern |
Functions for the external Query Menu.
Definition at line 76 of file functions.c.
|
extern |
Functions for the Smime Menu.
Definition at line 52 of file functions.c.
keycode_t AbortKey |