NeoMutt
2025-12-11-435-g4ac674
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
extended.c
Go to the documentation of this file.
1
22
28
29
#include "config.h"
30
#include <stdbool.h>
31
#include <strings.h>
32
#include "
mutt/lib.h
"
33
#include "
gui/lib.h
"
34
#include "
extended.h
"
35
#include "
keymap.h
"
36
40
struct
Extkey
41
{
42
const
char
*
name
;
43
const
char
*
sym
;
44
};
45
49
static
const
struct
Extkey
ExtKeys
[] = {
50
{
"<c-up>"
,
"kUP5"
},
51
{
"<s-up>"
,
"kUP"
},
52
{
"<a-up>"
,
"kUP3"
},
53
54
{
"<s-down>"
,
"kDN"
},
55
{
"<a-down>"
,
"kDN3"
},
56
{
"<c-down>"
,
"kDN5"
},
57
58
{
"<c-right>"
,
"kRIT5"
},
59
{
"<s-right>"
,
"kRIT"
},
60
{
"<a-right>"
,
"kRIT3"
},
61
62
{
"<s-left>"
,
"kLFT"
},
63
{
"<a-left>"
,
"kLFT3"
},
64
{
"<c-left>"
,
"kLFT5"
},
65
66
{
"<s-home>"
,
"kHOM"
},
67
{
"<a-home>"
,
"kHOM3"
},
68
{
"<c-home>"
,
"kHOM5"
},
69
70
{
"<s-end>"
,
"kEND"
},
71
{
"<a-end>"
,
"kEND3"
},
72
{
"<c-end>"
,
"kEND5"
},
73
74
{
"<s-next>"
,
"kNXT"
},
75
{
"<a-next>"
,
"kNXT3"
},
76
{
"<c-next>"
,
"kNXT5"
},
77
78
{
"<s-prev>"
,
"kPRV"
},
79
{
"<a-prev>"
,
"kPRV3"
},
80
{
"<c-prev>"
,
"kPRV5"
},
81
82
{ 0, 0 },
83
};
84
94
const
char
*
ext_key_find
(
const
char
*key)
95
{
96
for
(
int
i = 0;
ExtKeys
[i].name; i++)
97
{
98
if
(strcasecmp(key,
ExtKeys
[i].
name
) == 0)
99
return
ExtKeys
[i].sym;
100
}
101
return
0;
102
}
103
114
void
ext_keys_init
(
void
)
115
{
116
use_extended_names(
true
);
117
118
for
(
int
i = 0;
KeyNames
[i].name; i++)
119
{
120
if
(
KeyNames
[i].value == -1)
121
{
122
const
char
*keyname =
ext_key_find
(
KeyNames
[i].
name
);
123
124
if
(keyname)
125
{
126
const
char
*s =
mutt_tigetstr
((
char
*) keyname);
127
if
(s && ((
long
) (s) != -1))
128
{
129
int
code = key_defined(s);
130
if
(code > 0)
131
KeyNames
[i].value = code;
132
}
133
}
134
}
135
}
136
}
ext_key_find
const char * ext_key_find(const char *key)
Find the curses name for a key.
Definition
extended.c:94
ExtKeys
static const struct Extkey ExtKeys[]
Mapping between NeoMutt and Curses key names.
Definition
extended.c:49
ext_keys_init
void ext_keys_init(void)
Initialise map of ncurses extended keys.
Definition
extended.c:114
extended.h
Set up the extended keys.
lib.h
Convenience wrapper for the gui headers.
KeyNames
struct Mapping KeyNames[]
Key name lookup table.
Definition
keymap.c:42
keymap.h
Keymap handling.
lib.h
Convenience wrapper for the library headers.
Extkey
Map key names from NeoMutt's style to Curses style.
Definition
extended.c:41
Extkey::sym
const char * sym
Curses key name.
Definition
extended.c:43
Extkey::name
const char * name
NeoMutt key name.
Definition
extended.c:42
mutt_tigetstr
const char * mutt_tigetstr(const char *name)
Get terminal capabilities.
Definition
terminal.c:68