changeset 30780:b4fcea50ee82

(push_key_description): If C without modifiers is < 32, make sure to print `C-' before `M-', like in the manual.
author Gerd Moellmann <gerd@gnu.org>
date Mon, 14 Aug 2000 12:44:38 +0000
parents aa097d8d4f1a
children 59479ef35bf2
files src/keymap.c
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/keymap.c	Mon Aug 14 12:43:55 2000 +0000
+++ b/src/keymap.c	Mon Aug 14 12:44:38 2000 +0000
@@ -1824,8 +1824,12 @@
      register unsigned int c;
      register char *p;
 {
+  unsigned c2;
+  
   /* Clear all the meaningless bits above the meta bit.  */
   c &= meta_modifier | ~ - meta_modifier;
+  c2 = c & ~(alt_modifier | ctrl_modifier | hyper_modifier
+	     | meta_modifier | shift_modifier | super_modifier);
 
   if (c & alt_modifier)
     {
@@ -1833,11 +1837,12 @@
       *p++ = '-';
       c -= alt_modifier;
     }
-  if (c & ctrl_modifier)
+  if ((c & ctrl_modifier) != 0
+      || (c2 < ' ' && c2 != 27 && c2 != '\t' && c2 != Ctl ('M')))
     {
       *p++ = 'C';
       *p++ = '-';
-      c -= ctrl_modifier;
+      c &= ~ctrl_modifier;
     }
   if (c & hyper_modifier)
     {
@@ -1885,8 +1890,7 @@
 	}
       else
 	{
-	  *p++ = 'C';
-	  *p++ = '-';
+	  /* `C-' already added above.  */
 	  if (c > 0 && c <= Ctl ('Z'))
 	    *p++ = c + 0140;
 	  else