]> granicus.if.org Git - mutt/commitdiff
Use <fN> for function keys as well as for other special
authorThomas Roessler <roessler@does-not-exist.org>
Wed, 16 Sep 1998 06:40:27 +0000 (06:40 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Wed, 16 Sep 1998 06:40:27 +0000 (06:40 +0000)
keys.  Additionally, this patch makes it possible to use
all special keys inside a key _sequence_.

keymap.c

index b3f8c0e3964995592fe3c60fc8ff1c5908fe86cd..b1b9f18b6bd28e8540e4338776b9bdcb926fa5fb 100644 (file)
--- 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++;