summaryrefslogtreecommitdiffstats
path: root/keymap.c
diff options
context:
space:
mode:
authorThomas Roessler <roessler@does-not-exist.org>1998-09-16 06:40:27 +0000
committerThomas Roessler <roessler@does-not-exist.org>1998-09-16 06:40:27 +0000
commitb01b6fa864c36399ee52965069b51461e30edc4c (patch)
treeac4d9d4b11be7ee01442b90a45a111e68f909acc /keymap.c
parent8f97174d35873e1217ae7f2f12fd918a2bfbb6fc (diff)
Use <fN> for function keys as well as for other special
keys. Additionally, this patch makes it possible to use all special keys inside a key _sequence_.
Diffstat (limited to 'keymap.c')
-rw-r--r--keymap.c56
1 files changed, 43 insertions, 13 deletions
diff --git a/keymap.c b/keymap.c
index b3f8c0e3..b1b9f18b 100644
--- a/keymap.c
+++ b/keymap.c
@@ -86,28 +86,58 @@ static struct keymap_t *allocKeys (int len, keycode_t *keys)
return (p);
}
-static int parsekeys (char *s, keycode_t *d, int max)
+static int parse_fkey(char *s)
+{
+ char *t;
+ int n = 0;
+
+ if(s[0] != '<' || tolower(s[1]) != 'f')
+ return -1;
+
+ for(t = s + 2; *t && isdigit((unsigned char) *t); t++)
+ {
+ n *= 10;
+ n += *t - '0';
+ }
+
+ if(*t != '>')
+ return -1;
+ else
+ return n;
+}
+
+static int parsekeys (char *str, keycode_t *d, int max)
{
int n, len = max;
+ char buff[SHORT_STRING];
+ char c;
+ char *s, *t;
+ strfcpy(buff, str, sizeof(buff));
+ s = buff;
+
while (*s && len)
{
- if ((n = mutt_getvaluebyname (s, KeyNames)) != -1)
- {
- s += strlen (s);
- *d = n;
- }
- else if (tolower (*s) == 'f' && isdigit ((unsigned char) s[1]))
+ *d = '\0';
+ if(*s == '<' && (t = strchr(s, '>')))
{
- n = 0;
- for (s++; isdigit ((unsigned char) *s) ; s++)
+ t++; c = *t; *t = '\0';
+
+ if ((n = mutt_getvaluebyname (s, KeyNames)) != -1)
{
- n *= 10;
- n += *s - '0';
+ s = t;
+ *d = n;
}
- *d = KEY_F(n);
+ else if ((n = parse_fkey(s)) > 0)
+ {
+ s = t;
+ *d = KEY_F (n);
+ }
+
+ *t = c;
}
- else
+
+ if(!*d)
{
*d = *s;
s++;