]> granicus.if.org Git - mutt/commitdiff
The attached patch fixes a minor inconsistency between the display
authorThomas Roessler <roessler@does-not-exist.org>
Wed, 7 Oct 1998 17:07:04 +0000 (17:07 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Wed, 7 Oct 1998 17:07:04 +0000 (17:07 +0000)
of special key-names in the help screen and their actual usage. The
help screen now shows the special keys exactly as you
would/could/should use them in the muttrc/command-line. (From: Vikas
Agnihotri <VikasA@att.com>)

keymap.c

index 5f792e8a730dd9078109cf9ba35f8ff600712d6a..af6b97d50d74a1badb0d9feb633c0bd055e0ec6f 100644 (file)
--- a/keymap.c
+++ b/keymap.c
@@ -67,6 +67,9 @@ static struct mapping_t KeyNames[] = {
   { "<End>",   KEY_END },
   { "<Enter>", KEY_ENTER },
   { "<Return>",        M_ENTER_C },
+  { "<Esc>",   '\033' },
+  { "<Tab>",   '\t' },
+  { "<Space>", ' ' },
   { NULL,      0 }
 };
 
@@ -431,25 +434,12 @@ static void create_bindings (struct binding_t *map, int menu)
 
 char *km_keyname (int c)
 {
-  static char buf[5];
+  static char buf[10];
   char *p;
 
   if ((p = mutt_getnamebyvalue (c, KeyNames)))
     return p;
 
-  switch (c)
-  {
-    case '\033':
-      return "ESC";
-    case ' ':
-      return "SPC";
-    case '\n':
-    case '\r':
-      return "RET";
-    case '\t':
-      return "TAB";
-  }
-
   if (c < 256 && c > -128 && iscntrl ((unsigned char) c))
   {
     if (c < 0)
@@ -465,7 +455,7 @@ char *km_keyname (int c)
       snprintf (buf, sizeof (buf), "\\%d%d%d", c >> 6, (c >> 3) & 7, c & 7);
   }
   else if (c >= KEY_F0 && c < KEY_F(256)) /* this maximum is just a guess */
-    sprintf (buf, "F%d", c - KEY_F0);
+    sprintf (buf, "<F%d>", c - KEY_F0);
   else if (IsPrint (c))
     snprintf (buf, sizeof (buf), "%c", (unsigned char) c);
   else